(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestRepositoriesService_CreateStatus(t *testing.T) { |
| 63 | t.Parallel() |
| 64 | client, mux, _ := setup(t) |
| 65 | |
| 66 | input := RepoStatus{State: Ptr("s"), TargetURL: Ptr("t"), Description: Ptr("d")} |
| 67 | |
| 68 | mux.HandleFunc("/repos/o/r/statuses/r", func(w http.ResponseWriter, r *http.Request) { |
| 69 | testMethod(t, r, "POST") |
| 70 | testJSONBody(t, r, input) |
| 71 | fmt.Fprint(w, `{"id":1}`) |
| 72 | }) |
| 73 | |
| 74 | ctx := t.Context() |
| 75 | status, _, err := client.Repositories.CreateStatus(ctx, "o", "r", "r", input) |
| 76 | if err != nil { |
| 77 | t.Errorf("Repositories.CreateStatus returned error: %v", err) |
| 78 | } |
| 79 | |
| 80 | want := &RepoStatus{ID: Ptr(int64(1))} |
| 81 | if !cmp.Equal(status, want) { |
| 82 | t.Errorf("Repositories.CreateStatus returned %+v, want %+v", status, want) |
| 83 | } |
| 84 | |
| 85 | const methodName = "CreateStatus" |
| 86 | testBadOptions(t, methodName, func() (err error) { |
| 87 | _, _, err = client.Repositories.CreateStatus(ctx, "\n", "\n", "\n", input) |
| 88 | return err |
| 89 | }) |
| 90 | |
| 91 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 92 | got, resp, err := client.Repositories.CreateStatus(ctx, "o", "r", "r", input) |
| 93 | if got != nil { |
| 94 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 95 | } |
| 96 | return resp, err |
| 97 | }) |
| 98 | } |
| 99 | |
| 100 | func TestRepositoriesService_CreateStatus_invalidOwner(t *testing.T) { |
| 101 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…