Merge remote-tracking branch 'origin/main' into add-event-invitations

This commit is contained in:
ngqile committed 2026-12-01 17:11:14 +08:00
commit aed9473aba
16 files changed
+209 -34

No files matched your search

@@ -84,9 +84,9 @@ class AdminAuthControllerCompanyTest {
ArgumentCaptor<AuthRequest> sent = ArgumentCaptor.forClass(AuthRequest.class);
verify(auth).getToken(sent.capture());
assertThat(sent.getValue().getUsername()).isEqualTo("john@ins");
verify(auth).isLocked("john@ins");
verify(auth).record("john@ins", "LOGIN_SUCCESS", null);
assertThat(sent.getValue().getUsername()).isEqualTo("john@INS");
verify(auth).isLocked("john@INS");
verify(auth).record("john@INS", "LOGIN_SUCCESS", null);
}
@Test
@@ -114,7 +114,7 @@ class AdminAuthControllerCompanyTest {
void login_wrongCompanyOrUnknownUser_isBadLogin() throws Exception {
when(auth.getToken(any())).thenReturn(null);
login("{\"company\":\"nope\",\"username\":\"john\",\"password\":\"pw\"}").andExpect(status().isUnauthorized());
verify(auth).record("john@nope", "LOGIN_FAIL", null);
verify(auth).record("john@NOPE", "LOGIN_FAIL", null);
}
@Test
@@ -124,7 +124,7 @@ class AdminAuthControllerCompanyTest {
login("{\"company\":\"ins\",\"username\":\"john\",\"password\":\"pw\"}")
.andExpect(status().isUnauthorized()).andExpect(jsonPath("$.message").value("Invalid username or password"));
verify(auth).record("john@ins", "LOGIN_FAIL", null);
verify(auth).record("john@INS", "LOGIN_FAIL", null);
verify(authenticationService).logoutToken("tok");
}
@@ -154,10 +154,10 @@ class AdminAuthControllerCompanyTest {
mvc.perform(post("/api/admin/auth/forgot-password").contentType(MediaType.APPLICATION_JSON)
.content("{\"company\":\"INS\",\"username\":\"john\",\"email\":\"j@x.com\"}"))
.andExpect(status().isOk()).andExpect(jsonPath("$.result").value("true"));
verify(auth).resetAdminPassword("john@ins", "j@x.com");
verify(auth).resetAdminPassword("john@INS", "j@x.com");
mvc.perform(post("/api/admin/auth/forgot-password").contentType(MediaType.APPLICATION_JSON)
.content("{\"company\":\"ins\",\"username\":\"a@b\",\"email\":\"j@x.com\"}")).andExpect(status().isOk());
verify(auth, never()).resetAdminPassword(org.mockito.ArgumentMatchers.eq("a@b@ins"), anyString());
verify(auth, never()).resetAdminPassword(org.mockito.ArgumentMatchers.eq("a@b@INS"), anyString());
}
}