test: update infra tests for new authentication namespaces
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using FiscalOS.Core.Authentication;
|
||||||
using FiscalOS.Core.Identity;
|
using FiscalOS.Core.Identity;
|
||||||
|
|
||||||
namespace FiscalOS.API.Tests.Integration;
|
namespace FiscalOS.API.Tests.Integration;
|
||||||
@@ -16,6 +17,9 @@ public class LoginTests(TestApi testApi) : IntegrationTest(testApi)
|
|||||||
|
|
||||||
var res = await Client.PostAsJsonAsync("/login", req, TestContext.Current.CancellationToken);
|
var res = await Client.PostAsJsonAsync("/login", req, TestContext.Current.CancellationToken);
|
||||||
|
|
||||||
|
var content = await res.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
||||||
|
Console.WriteLine(content);
|
||||||
|
|
||||||
res.StatusCode.Should().Be(HttpStatusCode.BadRequest);
|
res.StatusCode.Should().Be(HttpStatusCode.BadRequest);
|
||||||
|
|
||||||
var problem = await res.Content.ReadFromJsonAsync<ValidationProblemDetails>(TestContext.Current.CancellationToken);
|
var problem = await res.Content.ReadFromJsonAsync<ValidationProblemDetails>(TestContext.Current.CancellationToken);
|
||||||
@@ -44,11 +48,7 @@ public class LoginTests(TestApi testApi) : IntegrationTest(testApi)
|
|||||||
{
|
{
|
||||||
var passwordHasher = sp.GetRequiredService<IPasswordHasher>();
|
var passwordHasher = sp.GetRequiredService<IPasswordHasher>();
|
||||||
|
|
||||||
context.Add(new User
|
context.Add(User.From("Stevan", passwordHasher.Hash("@Password1")));
|
||||||
{
|
|
||||||
Username = "Stevan",
|
|
||||||
HashedPassword = passwordHasher.Hash("@Password1"),
|
|
||||||
});
|
|
||||||
|
|
||||||
await context.SaveChangesAsync(TestContext.Current.CancellationToken);
|
await context.SaveChangesAsync(TestContext.Current.CancellationToken);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using FiscalOS.Infra.Authentication;
|
||||||
|
|
||||||
namespace FiscalOS.Infra.Tests.Unit;
|
namespace FiscalOS.Infra.Tests.Unit;
|
||||||
|
|
||||||
public class PasswordHasherTests
|
public class PasswordHasherTests
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
global using FiscalOS.Infra.Identity;
|
global using System.IdentityModel.Tokens.Jwt;
|
||||||
|
global using AwesomeAssertions.Primitives;
|
||||||
|
|
||||||
|
global using FiscalOS.Core.Identity;
|
||||||
|
global using FiscalOS.Infra.Authentication;
|
||||||
|
global using FiscalOS.Infra.Tests.Assertions;
|
||||||
|
|
||||||
|
global using Microsoft.Extensions.Options;
|
||||||
|
|||||||
Reference in New Issue
Block a user