(t *testing.T)
| 110 | } |
| 111 | |
| 112 | func TestIssueImportService_Create_badResponse(t *testing.T) { |
| 113 | t.Parallel() |
| 114 | client, mux, _ := setup(t) |
| 115 | |
| 116 | createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) |
| 117 | input := &IssueImportRequest{ |
| 118 | IssueImport: IssueImport{ |
| 119 | Assignee: Ptr("developer"), |
| 120 | Body: "Dummy description", |
| 121 | CreatedAt: &Timestamp{createdAt}, |
| 122 | Labels: []string{"l1", "l2"}, |
| 123 | Milestone: Ptr(1), |
| 124 | Title: "Dummy Issue", |
| 125 | }, |
| 126 | Comments: []*Comment{{ |
| 127 | CreatedAt: &Timestamp{createdAt}, |
| 128 | Body: "Comment body", |
| 129 | }}, |
| 130 | } |
| 131 | |
| 132 | mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { |
| 133 | testMethod(t, r, "POST") |
| 134 | testHeader(t, r, "Accept", mediaTypeIssueImportAPI) |
| 135 | testJSONBody(t, r, input) |
| 136 | w.WriteHeader(http.StatusAccepted) |
| 137 | assertWrite(t, w, []byte("{[}")) |
| 138 | }) |
| 139 | |
| 140 | ctx := t.Context() |
| 141 | _, _, err := client.IssueImport.Create(ctx, "o", "r", input) |
| 142 | |
| 143 | if err == nil || err.Error() != "invalid character '[' looking for beginning of object key string" { |
| 144 | t.Errorf("unexpected error: %v", err) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func TestIssueImportService_Create_invalidOwner(t *testing.T) { |
| 149 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…