forked from xanzy/go-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
366ce27
commit deb0c37
Showing
3 changed files
with
20 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,21 +26,20 @@ func TestGetAvatar(t *testing.T) { | |
mux, server, client := setup(t) | ||
defer teardown(server) | ||
|
||
const host = "https://google.com" | ||
const url = "https://www.gravatar.com/avatar/10e6bf7bcf22c2f00a3ef684b4ada178" | ||
|
||
mux.HandleFunc("/api/v4/avatar", | ||
func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, http.MethodGet) | ||
w.WriteHeader(http.StatusAccepted) | ||
avatar := Avatar{AvatarURL: host} | ||
avatar := Avatar{AvatarURL: url} | ||
resp, _ := json.Marshal(avatar) | ||
_, _ = w.Write(resp) | ||
}, | ||
) | ||
|
||
email := "test" | ||
|
||
avatar, resp, err := client.Avatar.GetAvatar(&GetAvatarOptions{Email: &email}) | ||
opt := &GetAvatarOptions{Email: String("[email protected]")} | ||
avatar, resp, err := client.Avatar.GetAvatar(opt) | ||
if err != nil { | ||
t.Fatalf("Avatar.GetAvatar returned error: %v", err) | ||
} | ||
|
@@ -49,7 +48,7 @@ func TestGetAvatar(t *testing.T) { | |
t.Fatalf("Avatar.GetAvatar returned wrong status code: %v", resp.Status) | ||
} | ||
|
||
if host != avatar.AvatarURL { | ||
t.Errorf("Avatar.GetAvatar wrong result %s, want %s", avatar.AvatarURL, host) | ||
if url != avatar.AvatarURL { | ||
t.Errorf("Avatar.GetAvatar wrong result %s, want %s", avatar.AvatarURL, url) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters