Skip to content

Commit

Permalink
fixup! HAI-1527 Audit logging for permission updates
Browse files Browse the repository at this point in the history
  • Loading branch information
corvidian committed Sep 1, 2023
1 parent abe60a8 commit c90d9f6
Showing 1 changed file with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,25 @@ class HankeKayttajaLoggingServiceTest {
verify {
auditLogService.create(
withArg { entry ->
try {
assertThat(entry.operation).isEqualTo(Operation.UPDATE)
assertThat(entry.status).isEqualTo(Status.SUCCESS)
assertThat(entry.failureDescription).isNull()
assertThat(entry.userId).isEqualTo(userId)
assertThat(entry.userRole).isEqualTo(UserRole.USER)
assertThat(entry.objectId)
.isEqualTo(PermissionFactory.PERMISSION_ID.toString())
assertThat(entry.objectType).isEqualTo(ObjectType.PERMISSION)
assertThat(entry.objectBefore).isNotNull().all {
contains(PermissionFactory.PERMISSION_ID.toString())
contains(PermissionFactory.USER_ID)
contains(PermissionFactory.HANKE_ID.toString())
contains("KATSELUOIKEUS")
}
assertThat(entry.objectAfter).isNotNull().all {
contains(PermissionFactory.PERMISSION_ID.toString())
contains(PermissionFactory.USER_ID)
contains(PermissionFactory.HANKE_ID.toString())
contains("HANKEMUOKKAUS")
}
} catch (e: Throwable) {
println("ASDF ${e.message}")
throw e
assertThat(entry.operation).isEqualTo(Operation.UPDATE)
assertThat(entry.status).isEqualTo(Status.SUCCESS)
assertThat(entry.failureDescription).isNull()
assertThat(entry.userId).isEqualTo(userId)
assertThat(entry.userRole).isEqualTo(UserRole.USER)
assertThat(entry.objectId)
.isEqualTo(PermissionFactory.PERMISSION_ID.toString())
assertThat(entry.objectType).isEqualTo(ObjectType.PERMISSION)
assertThat(entry.objectBefore).isNotNull().all {
contains(PermissionFactory.PERMISSION_ID.toString())
contains(PermissionFactory.USER_ID)
contains(PermissionFactory.HANKE_ID.toString())
contains("KATSELUOIKEUS")
}
assertThat(entry.objectAfter).isNotNull().all {
contains(PermissionFactory.PERMISSION_ID.toString())
contains(PermissionFactory.USER_ID)
contains(PermissionFactory.HANKE_ID.toString())
contains("HANKEMUOKKAUS")
}
}
)
Expand Down

0 comments on commit c90d9f6

Please sign in to comment.