Constrain test usernames to 32 chars

This commit is contained in:
Rory&
2026-07-10 08:10:37 +02:00
parent 25a6576326
commit a80fc0a1a3
4 changed files with 7 additions and 6 deletions
@@ -7,7 +7,7 @@ public class UserAbstraction(Config _config, SpacebarClientProviderService _clie
var ua = await _clientProvider.GetUnauthenticatedClientAsync(_config.TestInstance);
var tokenResponse = await ua.RegisterAsync(new() {
Email = $"{Guid.NewGuid().ToString()}@{Guid.NewGuid().ToString()}.tld",
Username = Guid.NewGuid().ToString(),
Username = Guid.NewGuid().ToString()[..32],
Password = Guid.NewGuid().ToString(),
DateOfBirth = new(),
Consent = true
@@ -25,5 +25,6 @@ public class TestFixture : TestBedFixture {
protected override IEnumerable<TestAppSettings> GetTestAppSettings() {
yield return new TestAppSettings { Filename = "appsettings.json", IsOptional = true };
yield return new TestAppSettings { Filename = Environment.GetEnvironmentVariable("TEST_APPSETTINGS_PATH"), IsOptional = true };
}
}
@@ -45,7 +45,7 @@
<ItemGroup>
<Content Include="appsettings*.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Content>
</ItemGroup>
@@ -20,7 +20,7 @@ public class AuthenticationTests(ITestOutputHelper testOutputHelper, TestFixture
public async Task RegisterUser() {
var res = await Assert.SuccessfullyHttpPostAsJsonAsync($"{_config.TestInstance}/api/v9/auth/register", new RegisterRequest() {
Email = $"{Guid.NewGuid().ToString()}@{Guid.NewGuid().ToString()}.tld",
Username = Guid.NewGuid().ToString(),
Username = Guid.NewGuid().ToString()[..32],
Password = Guid.NewGuid().ToString(),
DateOfBirth = new(),
Consent = true
@@ -36,7 +36,7 @@ public class AuthenticationTests(ITestOutputHelper testOutputHelper, TestFixture
var sw = Stopwatch.StartNew();
var rr = new RegisterRequest() {
Email = $"{Guid.NewGuid().ToString()}@{Guid.NewGuid().ToString()}.tld",
Username = Guid.NewGuid().ToString(),
Username = Guid.NewGuid().ToString()[..32],
Password = "password",
DateOfBirth = new(),
Consent = true
@@ -69,7 +69,7 @@ public class AuthenticationTests(ITestOutputHelper testOutputHelper, TestFixture
public async Task LoginUser() {
var rr = new RegisterRequest() {
Email = $"{Guid.NewGuid().ToString()}@{Guid.NewGuid().ToString()}.tld",
Username = Guid.NewGuid().ToString(),
Username = Guid.NewGuid().ToString()[..32],
Password = Guid.NewGuid().ToString(),
DateOfBirth = new(),
Consent = true
@@ -89,7 +89,7 @@ public class AuthenticationTests(ITestOutputHelper testOutputHelper, TestFixture
public async Task WhoAmI() {
var rr = new RegisterRequest() {
Email = $"{Guid.NewGuid().ToString()}@{Guid.NewGuid().ToString()}.tld",
Username = Guid.NewGuid().ToString(),
Username = Guid.NewGuid().ToString()[..32],
Password = Guid.NewGuid().ToString(),
DateOfBirth = new(),
Consent = true