fixed tests related to the login audit log
This commit is contained in:
parent
6514f6c867
commit
814bc331ae
@ -122,7 +122,7 @@ public class AuditLogControllerTest extends AbstractControllerTest {
|
|||||||
}
|
}
|
||||||
} while (pageData.hasNext());
|
} while (pageData.hasNext());
|
||||||
|
|
||||||
Assert.assertEquals(11, loadedAuditLogs.size());
|
Assert.assertEquals(11 + 1, loadedAuditLogs.size());
|
||||||
|
|
||||||
loadedAuditLogs = new ArrayList<>();
|
loadedAuditLogs = new ArrayList<>();
|
||||||
pageLink = new TimePageLink(5);
|
pageLink = new TimePageLink(5);
|
||||||
@ -136,7 +136,7 @@ public class AuditLogControllerTest extends AbstractControllerTest {
|
|||||||
}
|
}
|
||||||
} while (pageData.hasNext());
|
} while (pageData.hasNext());
|
||||||
|
|
||||||
Assert.assertEquals(11, loadedAuditLogs.size());
|
Assert.assertEquals(11 + 1, loadedAuditLogs.size());
|
||||||
|
|
||||||
loadedAuditLogs = new ArrayList<>();
|
loadedAuditLogs = new ArrayList<>();
|
||||||
pageLink = new TimePageLink(5);
|
pageLink = new TimePageLink(5);
|
||||||
@ -150,7 +150,7 @@ public class AuditLogControllerTest extends AbstractControllerTest {
|
|||||||
}
|
}
|
||||||
} while (pageData.hasNext());
|
} while (pageData.hasNext());
|
||||||
|
|
||||||
Assert.assertEquals(11, loadedAuditLogs.size());
|
Assert.assertEquals(11 + 1, loadedAuditLogs.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -298,15 +298,13 @@ public class TwoFactorAuthTest extends AbstractControllerTest {
|
|||||||
|
|
||||||
logInWithPreVerificationToken(username, password);
|
logInWithPreVerificationToken(username, password);
|
||||||
await("async audit log saving").during(1, TimeUnit.SECONDS);
|
await("async audit log saving").during(1, TimeUnit.SECONDS);
|
||||||
assertThat(getLogInAuditLogs()).isEmpty();
|
|
||||||
assertThat(userService.findUserById(tenantId, user.getId()).getAdditionalInfo()
|
|
||||||
.get("lastLoginTs")).isNull();
|
|
||||||
|
|
||||||
doPost("/api/auth/2fa/verification/check?providerType=TOTP&verificationCode=incorrect")
|
doPost("/api/auth/2fa/verification/check?providerType=TOTP&verificationCode=incorrect")
|
||||||
.andExpect(status().isBadRequest());
|
.andExpect(status().isBadRequest());
|
||||||
|
|
||||||
|
// there is the first login audit log after user activation
|
||||||
await("async audit log saving").atMost(1, TimeUnit.SECONDS)
|
await("async audit log saving").atMost(1, TimeUnit.SECONDS)
|
||||||
.until(() -> getLogInAuditLogs().size() == 1);
|
.until(() -> getLogInAuditLogs().size() == 2);
|
||||||
assertThat(getLogInAuditLogs().get(0)).satisfies(failedLogInAuditLog -> {
|
assertThat(getLogInAuditLogs().get(0)).satisfies(failedLogInAuditLog -> {
|
||||||
assertThat(failedLogInAuditLog.getActionStatus()).isEqualTo(ActionStatus.FAILURE);
|
assertThat(failedLogInAuditLog.getActionStatus()).isEqualTo(ActionStatus.FAILURE);
|
||||||
assertThat(failedLogInAuditLog.getActionFailureDetails()).containsIgnoringCase("verification code is incorrect");
|
assertThat(failedLogInAuditLog.getActionFailureDetails()).containsIgnoringCase("verification code is incorrect");
|
||||||
@ -316,7 +314,7 @@ public class TwoFactorAuthTest extends AbstractControllerTest {
|
|||||||
doPost("/api/auth/2fa/verification/check?providerType=TOTP&verificationCode=" + getCorrectTotp(totpTwoFaAccountConfig))
|
doPost("/api/auth/2fa/verification/check?providerType=TOTP&verificationCode=" + getCorrectTotp(totpTwoFaAccountConfig))
|
||||||
.andExpect(status().isOk());
|
.andExpect(status().isOk());
|
||||||
await("async audit log saving").atMost(1, TimeUnit.SECONDS)
|
await("async audit log saving").atMost(1, TimeUnit.SECONDS)
|
||||||
.until(() -> getLogInAuditLogs().size() == 2);
|
.until(() -> getLogInAuditLogs().size() == 3);
|
||||||
assertThat(getLogInAuditLogs().get(0)).satisfies(successfulLogInAuditLog -> {
|
assertThat(getLogInAuditLogs().get(0)).satisfies(successfulLogInAuditLog -> {
|
||||||
assertThat(successfulLogInAuditLog.getActionStatus()).isEqualTo(ActionStatus.SUCCESS);
|
assertThat(successfulLogInAuditLog.getActionStatus()).isEqualTo(ActionStatus.SUCCESS);
|
||||||
assertThat(successfulLogInAuditLog.getUserName()).isEqualTo(username);
|
assertThat(successfulLogInAuditLog.getUserName()).isEqualTo(username);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user