Skip to content

Commit

Permalink
Add unit test for new flow
Browse files Browse the repository at this point in the history
  • Loading branch information
rharpavat authored and bgavrilMS committed Feb 16, 2024
1 parent f28e36f commit 76baf60
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/public/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -891,4 +891,14 @@ func TestWithAuthenticationScheme(t *testing.T) {
t.Fatalf(`unexpected access token "%s"`, ar.AccessToken)
}

mockClient.AppendResponse(mock.WithBody(mock.GetTenantDiscoveryBody(lmo, tenant)))
mockClient.AppendResponse(mock.WithBody([]byte(`{"account_type":"Managed","cloud_audience_urn":"urn","cloud_instance_name":"...","domain_name":"..."}`)))
mockClient.AppendResponse(mock.WithBody(mock.GetAccessTokenBody(accessToken, idToken, refreshToken, clientInfo, 3600)))
ar, err = client.AcquireTokenByUsernamePassword(ctx, tokenScope, "username", "password", WithAuthenticationScheme(authScheme))
if err != nil {
t.Fatal(err)
}
if ar.AccessToken != fmt.Sprintf(mock.Authnschemeformat, accessToken) {
t.Fatalf(`unexpected access token "%s"`, ar.AccessToken)
}
}

0 comments on commit 76baf60

Please sign in to comment.