Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ID-757 remove google group syncing testing from integration tests. #1163

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,65 +173,6 @@ class SamApiSpec extends AnyFreeSpec with Matchers with ScalaFutures with CleanU
petEmail2 shouldBe petEmail1
}

"should synchronize groups with Google" taggedAs Tags.ExcludeInAlpha in {
val managedGroupId = UUID.randomUUID.toString
val adminPolicyName = "admin"
val Seq(user1: Credentials, user2: Credentials, user3: Credentials) = UserPool.chooseStudents(3)
val user1AuthToken = user1.makeAuthToken()
val Seq(user1Proxy: WorkbenchEmail, user2Proxy: WorkbenchEmail, user3Proxy: WorkbenchEmail) =
Seq(user1, user2, user3).map(user => Sam.user.proxyGroup(user.email)(user1AuthToken))

val waitTime = 10.minutes

Sam.user.createGroup(managedGroupId)(user1AuthToken)
register cleanUp Sam.user.deleteGroup(managedGroupId)(user1AuthToken)

val policies = Sam.user.listResourcePolicies("managed-group", managedGroupId)(user1AuthToken)
val policyEmail = policies.collect {
case SamModel.AccessPolicyResponseEntry(_, policy, email) if policy.memberEmails.nonEmpty => email
}
assert(policyEmail.size == 1) // Only the admin policy should be non-empty after creation

// The admin policy should contain only the user that created the group
awaitAssert(
Await
.result(googleDirectoryDAO.listGroupMembers(policyEmail.head), waitTime)
.getOrElse(Set.empty) should contain theSameElementsAs Set(user1Proxy.value),
waitTime,
5.seconds
)

// Change the membership of the admin policy to include users 1 and 2
Sam.user.setPolicyMembers(managedGroupId, adminPolicyName, Set(user1.email, user2.email))(user1AuthToken)
awaitAssert(
Await
.result(googleDirectoryDAO.listGroupMembers(policyEmail.head), waitTime)
.getOrElse(Set.empty) should contain theSameElementsAs Set(user1Proxy.value, user2Proxy.value),
waitTime,
5.seconds
)

// Add user 3 to the admin policy
Sam.user.addUserToPolicy(managedGroupId, adminPolicyName, user3.email)(user1AuthToken)
awaitAssert(
Await
.result(googleDirectoryDAO.listGroupMembers(policyEmail.head), waitTime)
.getOrElse(Set.empty) should contain theSameElementsAs Set(user1Proxy.value, user2Proxy.value, user3Proxy.value),
waitTime,
5.seconds
)

// Remove user 2 from the admin policy
Sam.user.removeUserFromPolicy(managedGroupId, adminPolicyName, user2.email)(user1AuthToken)
awaitAssert(
Await
.result(googleDirectoryDAO.listGroupMembers(policyEmail.head), waitTime)
.getOrElse(Set.empty) should contain theSameElementsAs Set(user1Proxy.value, user3Proxy.value),
waitTime,
5.seconds
)
}

"should only synchronize the intersection group for policies constrained by auth domains" taggedAs Tags.ExcludeInAlpha in {
val waitTime = 10.minutes
val authDomainId = UUID.randomUUID.toString
Expand Down
Loading