@@ -468,6 +468,32 @@ func TestSignupOK(t *testing.T) {
468468 // Re-activate the usersignup by calling the signup endpoint with the same token/user again
469469 signupUser (token , emailAddress , identity .Username , identity )
470470 })
471+
472+ t .Run ("test get signup returns expected response" , func (t * testing.T ) {
473+ // Get valid generated token for e2e tests.
474+ emailAddress := uuid .Must (uuid .NewV4 ()).String () + "@acme.com"
475+ identity , token , err := authsupport .NewToken (authsupport .WithEmail (emailAddress ), commonauth .WithUserIDClaim ("123" ), commonauth .WithAccountIDClaim ("456" ), commonauth .WithAccountNumberClaim ("789" ))
476+ require .NoError (t , err )
477+
478+ // Signup a new user
479+ userSignup := signupUser (token , emailAddress , identity .Username , identity )
480+
481+ t .Logf ("Signed up new user %+v" , userSignup )
482+
483+ // call GET /signup and verify expected response body fields are there
484+ now := time .Now ()
485+ NewGetSignupClient (t , await , identity .Username , token ).Invoke (signupIsProvisioned ,
486+ signupHasExpectedDates (now , now .Add (time .Hour * 24 * 30 )),
487+ signupHasExpectedClaims (map [string ]string {
488+ "name" : userSignup .Name ,
489+ "username" : userSignup .Spec .IdentityClaims .PreferredUsername ,
490+ "givenName" : userSignup .Spec .IdentityClaims .GivenName ,
491+ "familyName" : userSignup .Spec .IdentityClaims .FamilyName ,
492+ "userID" : "123" ,
493+ "accountID" : "456" ,
494+ "accountNumber" : "789" ,
495+ }))
496+ })
471497}
472498
473499func TestUserSignupFoundWhenNamedWithEncodedUsername (t * testing.T ) {
@@ -1005,6 +1031,16 @@ func signupHasExpectedDates(startDate, endDate time.Time) func(c *GetSignupClien
10051031 }
10061032}
10071033
1034+ func signupHasExpectedClaims (claims map [string ]string ) func (c * GetSignupClient ) {
1035+ return func (c * GetSignupClient ) {
1036+ for expectedClaim , expectedClaimValue := range claims {
1037+ actualClaimValue , claimFound := c .responseBody [expectedClaim ]
1038+ require .True (c .t , claimFound , "unable to find expected claim [%s]. Claims found %v" , expectedClaim , claims )
1039+ require .Equal (c .t , expectedClaimValue , actualClaimValue , "expected claim value [%s] doesn't match actual claim value [%s]" , expectedClaimValue , actualClaimValue )
1040+ }
1041+ }
1042+ }
1043+
10081044func signupIsProvisioned (client * GetSignupClient ) {
10091045 hostAwait := client .await .Host ()
10101046 memberAwait := client .await .Member1 ()
0 commit comments