From 1acae107883fc4eb12d49c114831fc484058b541 Mon Sep 17 00:00:00 2001 From: Nicolas Macian <40004186+nmacianx@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:19:36 -0300 Subject: [PATCH] bump API version for user add tenant roles (#480) --- descope/api/client.go | 2 +- descope/internal/mgmt/user_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/descope/api/client.go b/descope/api/client.go index d04876ea..4de62e6d 100644 --- a/descope/api/client.go +++ b/descope/api/client.go @@ -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 { diff --git a/descope/internal/mgmt/user_test.go b/descope/internal/mgmt/user_test.go index e70cbb7e..e0b28508 100644 --- a/descope/internal/mgmt/user_test.go +++ b/descope/internal/mgmt/user_test.go @@ -3,6 +3,7 @@ package mgmt import ( "context" "net/http" + "strings" "testing" "github.com/descope/go-sdk/descope" @@ -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)) @@ -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"])