26 lines
919 B
C#
26 lines
919 B
C#
using FluentAssertions;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Options;
|
|
using SWAD.API.Models.Config.ApiServices;
|
|
using SWAD.API.Services.MusicAPI.Auth;
|
|
|
|
namespace ApiTest.MusicApi;
|
|
|
|
public class Spotify
|
|
{
|
|
[Test]
|
|
public async Task SpotifyAuthTest()
|
|
{
|
|
var confbuilder = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory)
|
|
.AddJsonFile("appsettings.json")
|
|
.Build().GetSection(ApiServicesConfig.ConfigName);
|
|
//throw new Exception(Environment.CurrentDirectory);
|
|
IOptions<ApiServicesConfig> config = new OptionsWrapper<ApiServicesConfig>(confbuilder.Get<ApiServicesConfig>());
|
|
var authService = new SpotifyAuthService(config);
|
|
var authResponse = await authService.GetToken();
|
|
authResponse.Should()
|
|
.NotBeNull();
|
|
authResponse.Token.Should()
|
|
.NotBeNull();
|
|
}
|
|
} |