Skip to content

Commit

Permalink
attempt to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
salonishah11 committed Sep 11, 2024
1 parent 20c89c9 commit 422f283
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,22 +436,27 @@ class PermissionIntegrationSpec extends AnyFlatSpec with ScalatestRouteTest with
val stubEntity = AgoraEntity(agoraEntity2.namespace, agoraEntity2.name, agoraEntity2.snapshotId)
val found = entityAclList.find(_.entity.toShortString == stubEntity.toShortString)
assert(found.isDefined, "second")
assert(found.get.entity.public.isEmpty, "second") // since user doesn't have permission they shouldn't see additional information about method
// since user doesn't have permission they shouldn't see additional information about method
assertResult(None) {found.get.entity.public}
assert(found.get.message.get.contains("Authorization exception for user"), "second")
}
// check third - it doesn't exist in the db
{
val stubEntity = AgoraEntity(agoraEntity1.namespace, agoraEntity1.name, Some(12345))
val found = entityAclList.find(_.entity.toShortString == stubEntity.toShortString)
assert(found.isDefined, "third")
assertResult(Some(false)) {found.get.entity.public} // entity doesn't exist, so it's not public
// it seems when entity doesn't exist 'AgoraEntityAuthorizationException' is thrown and hence
// public information is now not available because of https://broadworkbench.atlassian.net/browse/WX-1764
assertResult(None) {found.get.entity.public}
}
// check fourth - it has been redacted, which resolves to us not having permissions to see it
{
val stubEntity = AgoraEntity(redactedEntity.namespace, redactedEntity.name, redactedEntity.snapshotId)
val found = entityAclList.find(_.entity.toShortString == stubEntity.toShortString)
assert(found.isDefined, "fourth")
assertResult(Some(false)) {found.get.entity.public} // when redacted, so it's not public
// it seems when entity is redacted 'AgoraEntityAuthorizationException' is thrown and hence
// public information is now not available because of https://broadworkbench.atlassian.net/browse/WX-1764
assertResult(None) {found.get.entity.public}
}
}
}
Expand Down

0 comments on commit 422f283

Please sign in to comment.