mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 11:03:59 +00:00
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:
parent
e3ca33e4c7
commit
2bcc40fd50
@ -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());
|
||||
|
||||
@ -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"));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user