Skip to content

Commit

Permalink
fix linting and error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
fschoell committed Apr 7, 2022
1 parent ed5cf92 commit 8bf23c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions management/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ func (m *UserManager) Link(id string, il *UserIdentityLink, opts ...RequestOptio
// Unlink unlinks an identity from a user making it a separate account again.
//
// See: https://auth0.com/docs/api/management/v2#!/Users/delete_user_identity_by_user_id
func (m *UserManager) Unlink(id, provider, userId string, opts ...RequestOption) (uIDs []UserIdentity, err error) {
err = m.Request("DELETE", m.URI("users", id, "identities", provider, userId), &uIDs, opts...)
func (m *UserManager) Unlink(id, provider, userID string, opts ...RequestOption) (uIDs []UserIdentity, err error) {
err = m.Request("DELETE", m.URI("users", id, "identities", provider, userID), &uIDs, opts...)
return
}

Expand Down
11 changes: 8 additions & 3 deletions management/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ func TestUser(t *testing.T) {
})

t.Run("Unlink", func(t *testing.T) {

cs, err := m.Connection.ReadByName("Username-Password-Authentication")
if err != nil {
t.Error(err)
Expand Down Expand Up @@ -406,14 +405,20 @@ func TestUser(t *testing.T) {
if err != nil {
t.Error(err)
}
jsonLinkedIdentities, _ := json.Marshal(linkedIdentities)
jsonLinkedIdentities, err := json.Marshal(linkedIdentities)
if err != nil {
t.Error(err)
}
t.Logf("%v\n", string(jsonLinkedIdentities))

unlinkedIdentities, err := m.User.Unlink(mainUser.GetID(), "auth0", strings.TrimPrefix(secondaryUser.GetID(), "auth0|"))
if err != nil {
t.Error(err)
}
jsonUnlinkedIdentities, _ := json.Marshal(unlinkedIdentities)
jsonUnlinkedIdentities, err := json.Marshal(unlinkedIdentities)
if err != nil {
t.Error(err)
}
t.Logf("%v\n", string(jsonUnlinkedIdentities))

t.Cleanup(func() {
Expand Down

0 comments on commit 8bf23c7

Please sign in to comment.