Skip to content

Commit

Permalink
Merge pull request #401 from okta/update-spec
Browse files Browse the repository at this point in the history
update spec and test
  • Loading branch information
duytiennguyen-okta committed Aug 22, 2023
2 parents 97060b6 + 4013bd3 commit 135ee76
Show file tree
Hide file tree
Showing 9 changed files with 10,782 additions and 4,573 deletions.
15,248 changes: 10,718 additions & 4,530 deletions .generator/okta-management-APIs-oasv3-enum-inheritance.yaml

Large diffs are not rendered by default.

60 changes: 30 additions & 30 deletions .generator/templates/api_application_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .generator/templates/api_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func Test_List_Assigned_Applications_For_Group(t *testing.T) {
assert.Equal(t, 0, len(apps), "there shouldn't be any apps assigned to group")
createdApp, _, err = setupBookmarkApplication(randomTestString())
require.NoError(t, err, "Creating an application should not error")
aareq := apiClient.ApplicationApi.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BookmarkApplication.GetId(), group.GetId())
aareq := apiClient.ApplicationGroupsApi.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BookmarkApplication.GetId(), group.GetId())
aareq.applicationGroupAssignment = NewApplicationGroupAssignment()
_, _, err = aareq.Execute()
require.NoError(t, err, "Assigning application to group should not error")
Expand Down
10 changes: 6 additions & 4 deletions .generator/templates/api_idp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,12 @@ func Test_Get_Linked_User(t *testing.T) {
require.NoError(t, err, "Could not get user's idp")
assert.Equal(t, createdUser.GetId(), linkUser.GetId())
var idpInLink bool
if idp, ok := linkUser.Links["idp"]; ok {
if href, ok := idp["href"]; ok {
if strings.Contains(fmt.Sprintf("%v", href), createdIdp.GetId()) {
idpInLink = true
if idp, ok := linkUser.Links.AdditionalProperties["idp"]; ok {
if hrefMap, ok := idp.(map[string]interface{}); ok {
if href, ok := hrefMap["href"]; ok {
if strings.Contains(fmt.Sprintf("%v", href), createdIdp.GetId()) {
idpInLink = true
}
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions .generator/templates/api_test.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
{{#appName}}
{{{.}}}
{{/appName}}

Testing {{classname}}Service

*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech);
// These test need to be empty because of non native (enum) type our sdk have
package {{packageName}}
7 changes: 3 additions & 4 deletions .generator/templates/api_user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,15 +342,14 @@ func Test_List_User_Subscriptions(t *testing.T) {
user, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, "me").Execute()
require.NoError(t, err, "Getting the current user should not error")
t.Run("get user subscription", func(t *testing.T) {
subscriptions, _, err := apiClient.SubscriptionApi.ListUserSubscriptions(apiClient.cfg.Context, user.GetId()).Execute()
subscriptions, _, err := apiClient.SubscriptionApi.ListSubscriptionsUser(apiClient.cfg.Context, user.GetId()).Execute()
require.NoError(t, err, "Should not error listing user subscriptions")
assert.True(t, len(subscriptions) > 0, "User should have subscriptions")
})
t.Run("get user subscription by notification type", func(t *testing.T) {
expectedNotificationType := "OKTA_ANNOUNCEMENT"
subscription, _, err := apiClient.SubscriptionApi.ListUserSubscriptionsByNotificationType(apiClient.cfg.Context, user.GetId(), expectedNotificationType).Execute()
subscription, _, err := apiClient.SubscriptionApi.GetSubscriptionsNotificationTypeUser(apiClient.cfg.Context, NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, user.GetId()).Execute()
require.NoError(t, err, "Should not error getting user subscription by notification types")
assert.Equal(t, subscription.GetNotificationType(), NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, "User should have subscription notification type %q, got %q", expectedNotificationType, subscription.NotificationType)
assert.Equal(t, subscription.GetNotificationType(), NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, "User should have subscription notification type %q, got %q", NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, subscription.NotificationType)
})
}

Expand Down
13 changes: 11 additions & 2 deletions .generator/templates/go.mod.mustache
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
module {{gitHost}}/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}}/{{versionName}}

go 1.13
go 1.20

require (
{{#withAWSV4Signature}}
github.com/aws/aws-sdk-go v1.34.14
{{/withAWSV4Signature}}
github.com/cenkalti/backoff/v4 v4.1.3
github.com/go-jose/go-jose/v3 v3.0.0
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/jarcoal/httpmock v1.2.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627
github.com/stretchr/testify v1.7.1
golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.25.0 // indirect
)
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/maxatome/go-testdeep v1.11.0 h1:Tgh5efyCYyJFGUYiT0qxBSIDeXw0F5zSoatlou685kk=
github.com/maxatome/go-testdeep v1.11.0/go.mod h1:011SgQ6efzZYAen6fDn4BqQ+lUR72ysdyKe7Dyogw70=
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627 h1:pSCLCl6joCFRnjpeojzOpEYs4q7Vditq8fySFG5ap3Y=
github.com/patrickmn/go-cache v0.0.0-20180815053127-5633e0862627/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepareReleaseBranch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install openapi generator
run: npm install @openapitools/openapi-generator-cli -g
- name: Set openapi generator version
run: openapi-generator-cli version-manager set 6.0.1
run: openapi-generator-cli version-manager set 6.6.0
- name: Generate go client
run: make v3-generate
- run: make fmt
Expand Down

0 comments on commit 135ee76

Please sign in to comment.