0
0
mirror of https://github.com/alex289/CleanArchitecture.git synced 2025-07-01 11:02:57 +00:00
CleanArchitecture/CleanArchitecture.IntegrationTests/UtilityTests/AuthTests.cs
2024-08-03 14:22:17 +02:00

31 lines
894 B
C#

using System.Net;
using System.Threading.Tasks;
using CleanArchitecture.IntegrationTests.Fixtures;
using FluentAssertions;
namespace CleanArchitecture.IntegrationTests.UtilityTests;
public sealed class AuthTests
{
private readonly AuthTestFixure _fixture = new();
[OneTimeSetUp]
public async Task Setup() => await GlobalSetupFixture.RespawnDatabaseAsync();
[Datapoints]
public string[] values =
[
"/api/v1/user",
"/api/v1/user/me",
"/api/v1/user/d74b112a-ece0-443d-9b4f-85bc418822ca",
"/api/v1/tenant",
"/api/v1/tenant/d74b112a-ece0-443d-9b4f-85bc418822ca"
];
[Theory]
public async Task Should_Get_Unauthorized_If_Trying_To_Call_Endpoint_Without_Token(string url)
{
var response = await _fixture.ServerClient.GetAsync(url);
response.StatusCode.Should().Be(HttpStatusCode.Unauthorized);
}
}