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
OKTA-285607: add authorization servers integration tests #388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the work here! I left a few comments. Basically, we shouldn't rely so much on certain default settings nor modify them.
8def64d
to
de0b8ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Please check my comments. We need to make sure we have aliases for policies, scopes, and claims and use them instead.
78de594
to
a5ba442
Compare
@laura-rodriguez I updated to use aliases. I ran all the tests locally against my own org and everything passed. |
}; | ||
|
||
var createdAuthorizationServer = await testClient.AuthorizationServers.CreateAuthorizationServerAsync(testAuthorizationServer); | ||
var createdPolicy = await testClient.AuthorizationServers.CreateAuthorizationServerPolicyAsync(testPolicy, createdAuthorizationServer.Id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an alias for CreateAuthorizationServerPolicyAsync
?
var createdPolicy = await testClient.AuthorizationServers.CreateAuthorizationServerPolicyAsync(testPolicy, createdAuthorizationServer.Id); | ||
try | ||
{ | ||
var policies = await testClient.AuthorizationServers.ListAuthorizationServerPolicies(createdAuthorizationServer.Id).ToListAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an alias for ListAuthorizationServerPolicies
?
createdAuthorizationServer.Should().NotBeNull(); | ||
createdPolicy.Should().NotBeNull(); | ||
|
||
var retrievedPolicy = await testClient.AuthorizationServers.GetAuthorizationServerPolicyAsync(createdAuthorizationServer.Id, createdPolicy.Id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an alias for GetAuthorizationServerPolicyAsync
?
var testPolicy = new OAuthAuthorizationPolicy | ||
{ | ||
Name = $"{SdkPrefix}:Test Policy", | ||
Type = PolicyType.OauthAuthorizationPolicy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should rename OauthAuthorizationPolicy
to OAuthAuthorizationPolicy
to be consistent with the policy name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a pre-existing type from a couple years ago. Wasn't sure if changing it would cause issues if it is already referenced outside of what we can see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have renamed other stuff as well keeping in mind that all SDKs will release a major version.
{ | ||
updatedPolicy.Should().NotBeNull(); | ||
updatedPolicy.Name.Should().Be($"{SdkPrefix}:Test Policy Updated"); | ||
updatedPolicy.Description.Should().Be( "Test policy description updated"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Fix space after parentheses.
var createdOAuthScope = await createdAuthorizationServer.CreateOAuth2ScopeAsync(testOAuthScope); | ||
try | ||
{ | ||
var allAuthorizationServerScopes = await testClient.AuthorizationServers.ListOAuth2Scopes(createdAuthorizationServer.Id).ToListAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an alias for ListOAuth2Scopes
?
createdAuthorizationServer.Should().NotBeNull(); | ||
createdOAuthClaim.Should().NotBeNull(); | ||
createdOAuthClaim.Name.Should().Be(testOAuthClaim.Name); | ||
var updatedOAuthScope = await testClient.AuthorizationServers.UpdateOAuth2ClaimAsync(testUpdatedOAuthClaim, createdAuthorizationServer.Id, createdOAuthClaim.Id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DO we have an alias for UpdateOAuth2ClaimAsync
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Issue #
OKTA-285607
Code