Use sorted username dropdown for character owner editing
This commit is contained in:
@@ -29,4 +29,22 @@ public sealed class AuthApiTests : ApiTestBase
|
||||
var invalidLogin = await client.PostAsJsonAsync("/api/auth/login", new LoginRequest("alice", "wrong-password"));
|
||||
Assert.Equal(HttpStatusCode.BadRequest, invalidLogin.StatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task UsernamesEndpoint_RequiresAuthAndReturnsAlphabeticalList()
|
||||
{
|
||||
using var factory = CreateFactory();
|
||||
using var client = factory.CreateClient(new() { AllowAutoRedirect = false });
|
||||
|
||||
await RegisterAsync(client, "zoe", "Password123", "Zoe");
|
||||
await RegisterAsync(client, "amy", "Password123", "Amy");
|
||||
await RegisterAsync(client, "bob", "Password123", "Bob");
|
||||
|
||||
var unauthorized = await client.GetAsync("/api/users/usernames");
|
||||
Assert.Equal(HttpStatusCode.Unauthorized, unauthorized.StatusCode);
|
||||
|
||||
await LoginAsync(client, "bob", "Password123");
|
||||
var usernames = await GetAsync<IReadOnlyList<string>>(client, "/api/users/usernames");
|
||||
Assert.Equal(["amy", "bob", "zoe"], usernames);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user