Skip to content

Commit

Permalink
bump API version for user add tenant roles (#480)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmacianx authored Nov 23, 2024
1 parent 29a36b2 commit 1acae10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion descope/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ func (e *endpoints) ManagementUserSetRole() string {
}

func (e *endpoints) ManagementUserAddRole() string {
return path.Join(e.version, e.mgmt.userAddRole)
return path.Join(e.versionV2, e.mgmt.userAddRole)
}

func (e *endpoints) ManagementUserRemoveRole() string {
Expand Down
3 changes: 3 additions & 0 deletions descope/internal/mgmt/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package mgmt
import (
"context"
"net/http"
"strings"
"testing"

"github.com/descope/go-sdk/descope"
Expand Down Expand Up @@ -1147,6 +1148,7 @@ func TestUserAddRoleSuccess(t *testing.T) {
"roleNames": []string{"foo"},
}}
m := newTestMgmt(nil, helpers.DoOkWithBody(func(r *http.Request) {
assert.True(t, strings.HasPrefix(r.URL.RequestURI(), "/v2/"))
require.Equal(t, r.Header.Get("Authorization"), "Bearer a:key")
req := map[string]any{}
require.NoError(t, helpers.ReadBody(r, &req))
Expand Down Expand Up @@ -1457,6 +1459,7 @@ func TestUserAddTenantRoleSuccess(t *testing.T) {
}}
m := newTestMgmt(nil, helpers.DoOkWithBody(func(r *http.Request) {
require.Equal(t, r.Header.Get("Authorization"), "Bearer a:key")
assert.True(t, strings.HasPrefix(r.URL.RequestURI(), "/v2/"))
req := map[string]any{}
require.NoError(t, helpers.ReadBody(r, &req))
require.Equal(t, "abc", req["loginId"])
Expand Down

0 comments on commit 1acae10

Please sign in to comment.