fix(prole-auth): update tests for SessionUser groups field

SessionUser record was extended with List<String> groups in the groups
feature; test constructors still used the old 2-arg form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chrisfu 2026-04-02 16:56:09 -07:00
parent e3ca33e4c7
commit 2bcc40fd50
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@ class SessionTokenServiceTest {
Clock clock = Clock.fixed(Instant.parse("2026-03-20T00:00:00Z"), ZoneOffset.UTC);
SessionTokenService svc = SessionTokenService.forTests(om, clock);
String token = svc.issue("secret", new SessionUser("alice", "alice@prole.org"), Duration.ofMinutes(5));
String token = svc.issue("secret", new SessionUser("alice", "alice@prole.org", java.util.List.of()), Duration.ofMinutes(5));
assertNotNull(token);
SessionUser user = svc.verify("secret", token).orElseThrow();
@ -29,7 +29,7 @@ class SessionTokenServiceTest {
ObjectMapper om = new ObjectMapper();
Clock clock = Clock.fixed(Instant.parse("2026-03-20T00:00:00Z"), ZoneOffset.UTC);
SessionTokenService svc = SessionTokenService.forTests(om, clock);
String token = svc.issue("secret", new SessionUser("alice", "alice@prole.org"), Duration.ofMinutes(5));
String token = svc.issue("secret", new SessionUser("alice", "alice@prole.org", java.util.List.of()), Duration.ofMinutes(5));
assertTrue(svc.verify("other", token).isEmpty());
}
@ -38,7 +38,7 @@ class SessionTokenServiceTest {
ObjectMapper om = new ObjectMapper();
Clock clock = Clock.fixed(Instant.parse("2026-03-20T00:00:00Z"), ZoneOffset.UTC);
SessionTokenService svc = SessionTokenService.forTests(om, clock);
String token = svc.issue("secret", new SessionUser("alice", "alice@prole.org"), Duration.ofSeconds(1));
String token = svc.issue("secret", new SessionUser("alice", "alice@prole.org", java.util.List.of()), Duration.ofSeconds(1));
SessionTokenService svcLater = SessionTokenService.forTests(om, Clock.fixed(Instant.parse("2026-03-20T00:10:00Z"), ZoneOffset.UTC));
assertTrue(svcLater.verify("secret", token).isEmpty());

View File

@ -34,7 +34,7 @@ class VerifyControllerTest {
@Test
void authenticatedGetsHeaders() throws Exception {
String token = tokens.issue("test-secret", new SessionUser("alice", "alice@prole.org"), Duration.ofMinutes(10));
String token = tokens.issue("test-secret", new SessionUser("alice", "alice@prole.org", java.util.List.of()), Duration.ofMinutes(10));
mvc.perform(get("/auth/verify").header(HttpHeaders.COOKIE, "prole_session=" + token))
.andExpect(status().isOk())
.andExpect(header().string(VerifyController.USER_HEADER, "alice"));