2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-30 22:05:21 +00:00
This commit is contained in:
Aravindh-Raju
2023-07-10 11:35:24 +05:30
parent 78194e7dc9
commit a7c9c08f66

View File

@@ -341,6 +341,57 @@ class MySqlZoneRepositoryIntegrationSpec
groupRepository.delete(okGroup).unsafeRunSync()
}
"check pagination while filtering zones by admin group" in {
executeWithinTransaction { db: DB =>
groupRepository.save(db, okGroup)
}.unsafeRunSync()
val group = groupRepository.getGroupsByName(okGroup.name).unsafeRunSync()
val groupId = group.head.id
// store all of the zones
val privateZone = okZone.copy(
name = "private-zone.",
id = UUID.randomUUID().toString,
acl = ZoneACL(),
adminGroupId = groupId
)
val sharedZone = okZone.copy(
name = "shared-zone.",
id = UUID.randomUUID().toString,
acl = ZoneACL(),
shared = true,
adminGroupId = groupId
)
val testZones = Seq(privateZone, sharedZone)
val f = saveZones(testZones)
// query for all zones for the ok user, should have all of the zones returned
val okUserAuth = AuthPrincipal(
signedInUser = okUser,
memberGroupIds = groups.map(_.id)
)
f.unsafeRunSync()
val page1 = repo
.listZonesByAdminGroupIds(okUserAuth, None, 1, Set(groupId), ignoreAccess = true)
.unsafeRunSync()
page1.zones.head shouldBe testZones.head
val page2 = repo
.listZonesByAdminGroupIds(okUserAuth, page1.nextId, 1, Set(groupId), ignoreAccess = true)
.unsafeRunSync()
page2.zones.head shouldBe testZones.last
// delete the group created to test
groupRepository.delete(okGroup).unsafeRunSync()
}
"get empty list when no matching admin group name is found while filtering zones by group name" in {
executeWithinTransaction { db: DB =>