From c39d5765d43ddee6454163c417a6d4851ae84d5f Mon Sep 17 00:00:00 2001 From: 178inaba <178inaba@users.noreply.github.com> Date: Mon, 17 Apr 2017 00:07:31 +0900 Subject: [PATCH] Fix cover error to TestGetFollowRequests --- accounts_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/accounts_test.go b/accounts_test.go index 3bc55b2..b891225 100644 --- a/accounts_test.go +++ b/accounts_test.go @@ -129,7 +129,13 @@ func TestAccountUnfollow(t *testing.T) { } func TestGetFollowRequests(t *testing.T) { + canErr := true 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"}]`) return })) @@ -141,6 +147,10 @@ func TestGetFollowRequests(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) + _, err := client.GetFollowRequests() + if err == nil { + t.Fatalf("should be fail: %v", err) + } fReqs, err := client.GetFollowRequests() if err != nil { t.Fatalf("should not be fail: %v", err)