From 2a1a03ef6c332ecf1a5438a5f3f0acb37769bbcd Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Mon, 2 Feb 2026 13:18:41 -0600 Subject: [PATCH] test: update infra tests for new authentication namespaces --- tests/FiscalOS.API.Tests/Integration/LoginTests.cs | 10 +++++----- tests/FiscalOS.Infra.Tests/Unit/PasswordHasherTests.cs | 2 ++ tests/FiscalOS.Infra.Tests/Usings.cs | 9 ++++++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/FiscalOS.API.Tests/Integration/LoginTests.cs b/tests/FiscalOS.API.Tests/Integration/LoginTests.cs index e34dd8d..17b8bb1 100644 --- a/tests/FiscalOS.API.Tests/Integration/LoginTests.cs +++ b/tests/FiscalOS.API.Tests/Integration/LoginTests.cs @@ -1,3 +1,4 @@ +using FiscalOS.Core.Authentication; using FiscalOS.Core.Identity; 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 content = await res.Content.ReadAsStringAsync(TestContext.Current.CancellationToken); + Console.WriteLine(content); + res.StatusCode.Should().Be(HttpStatusCode.BadRequest); var problem = await res.Content.ReadFromJsonAsync(TestContext.Current.CancellationToken); @@ -44,11 +48,7 @@ public class LoginTests(TestApi testApi) : IntegrationTest(testApi) { var passwordHasher = sp.GetRequiredService(); - context.Add(new User - { - Username = "Stevan", - HashedPassword = passwordHasher.Hash("@Password1"), - }); + context.Add(User.From("Stevan", passwordHasher.Hash("@Password1"))); await context.SaveChangesAsync(TestContext.Current.CancellationToken); }); diff --git a/tests/FiscalOS.Infra.Tests/Unit/PasswordHasherTests.cs b/tests/FiscalOS.Infra.Tests/Unit/PasswordHasherTests.cs index 19f9de7..a731e08 100644 --- a/tests/FiscalOS.Infra.Tests/Unit/PasswordHasherTests.cs +++ b/tests/FiscalOS.Infra.Tests/Unit/PasswordHasherTests.cs @@ -1,3 +1,5 @@ +using FiscalOS.Infra.Authentication; + namespace FiscalOS.Infra.Tests.Unit; public class PasswordHasherTests diff --git a/tests/FiscalOS.Infra.Tests/Usings.cs b/tests/FiscalOS.Infra.Tests/Usings.cs index 9082166..2e623ad 100644 --- a/tests/FiscalOS.Infra.Tests/Usings.cs +++ b/tests/FiscalOS.Infra.Tests/Usings.cs @@ -1 +1,8 @@ -global using FiscalOS.Infra.Identity; \ No newline at end of file +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;