Skip to content

Commit

Permalink
more error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
mooreds committed Jul 2, 2024
1 parent 9a8e47a commit 531a347
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/fusionauth/Client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package fusionauth

import (
"fmt"
"encoding/json"
"net/http"
"net/url"
"os"
Expand All @@ -39,12 +41,23 @@ var (
var faClient = NewClient(httpClient, baseURL, "af69486b-4733-4470-a592-f1bfce7af580")

func TestRetrieveUserFail(t *testing.T) {
userResponse, _, _ := faClient.RetrieveUser("[email protected]")
userResponse, errors, _ := faClient.RetrieveUser("[email protected]")

errJson, _ := json.Marshal(errors)
fmt.Println(string(errJson))

assert.Equal(t, 0, len(errors.FieldErrors))
assert.Equal(t, 0, len(errors.GeneralErrors))
assert.Equal(t, 401, userResponse.StatusCode)
}

func TestRetrieveUserSuccess(t *testing.T) {
userResponse, _, _ := faClient.RetrieveUser("[email protected]")
userResponse, errors, _ := faClient.RetrieveUser("[email protected]")
errJson, _ := json.Marshal(errors)
fmt.Println(string(errJson))

assert.Equal(t, 0, len(errors.FieldErrors))
assert.Equal(t, 0, len(errors.GeneralErrors))
assert.Equal(t, 200, userResponse.StatusCode)
}

Expand Down

0 comments on commit 531a347

Please sign in to comment.