Fix cover error to TestGetFollowRequests

pull/16/head
178inaba 2017-04-17 00:07:31 +09:00
parent f5194b9ebb
commit c39d5765d4
1 changed files with 10 additions and 0 deletions

View File

@ -129,7 +129,13 @@ func TestAccountUnfollow(t *testing.T) {
} }
func TestGetFollowRequests(t *testing.T) { func TestGetFollowRequests(t *testing.T) {
canErr := true
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if canErr {
canErr = false
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`) fmt.Fprintln(w, `[{"Username": "foo"}, {"Username": "bar"}]`)
return return
})) }))
@ -141,6 +147,10 @@ func TestGetFollowRequests(t *testing.T) {
ClientSecret: "bar", ClientSecret: "bar",
AccessToken: "zoo", AccessToken: "zoo",
}) })
_, err := client.GetFollowRequests()
if err == nil {
t.Fatalf("should be fail: %v", err)
}
fReqs, err := client.GetFollowRequests() fReqs, err := client.GetFollowRequests()
if err != nil { if err != nil {
t.Fatalf("should not be fail: %v", err) t.Fatalf("should not be fail: %v", err)