Skip to content

Commit

Permalink
add test to confirm that propagatedclaims are correctly propagated al…
Browse files Browse the repository at this point in the history
…l the way from UserSignup to UserAccount (#813)
  • Loading branch information
sbryzak authored Oct 10, 2023
1 parent 78157ad commit 38c7b79
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/e2e/usersignup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,39 @@ func (s *userSignupIntegrationTest) TestUserResourcesCreatedWhenOriginalSubIsSet
VerifyResourcesProvisionedForSignup(s.T(), s.Awaitilities, userSignup, "deactivate30", "base")
}

func (s *userSignupIntegrationTest) TestUserResourcesUpdatedWhenPropagatedClaimsModified() {
hostAwait := s.Host()

// given
hostAwait.UpdateToolchainConfig(s.T(), testconfig.AutomaticApproval().Enabled(true))

// when
userSignup, _ := NewSignupRequest(s.Awaitilities).
Username("test-user-resources-updated").
Email("[email protected]").
UserID("43215432").
AccountID("ppqnnn00099").
EnsureMUR().
RequireConditions(wait.ConditionSet(wait.Default(), wait.ApprovedAutomatically())...).
Execute(s.T()).Resources()

// then
VerifyResourcesProvisionedForSignup(s.T(), s.Awaitilities, userSignup, "deactivate30", "base")

// Update the UserSignup
userSignup, err := hostAwait.UpdateUserSignup(s.T(), userSignup.Name, func(us *toolchainv1alpha1.UserSignup) {
// Modify the user's AccountID
us.Spec.IdentityClaims.AccountID = "nnnbbb111234"
})
require.NoError(s.T(), err)

// Confirm the AccountID is updated
require.Equal(s.T(), "nnnbbb111234", userSignup.Spec.IdentityClaims.AccountID)

// Verify that the resources are updated with the propagated claim
VerifyResourcesProvisionedForSignup(s.T(), s.Awaitilities, userSignup, "deactivate30", "base")
}

// TestUserResourcesCreatedWhenOriginalSubIsSetAndUserIDSameAsSub tests the case where:
//
// 1. sub claim set manually by test
Expand Down

0 comments on commit 38c7b79

Please sign in to comment.