(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestIssueImportService_Create_deferred(t *testing.T) { |
| 72 | t.Parallel() |
| 73 | client, mux, _ := setup(t) |
| 74 | |
| 75 | createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC) |
| 76 | input := &IssueImportRequest{ |
| 77 | IssueImport: IssueImport{ |
| 78 | Assignee: Ptr("developer"), |
| 79 | Body: "Dummy description", |
| 80 | CreatedAt: &Timestamp{createdAt}, |
| 81 | Labels: []string{"l1", "l2"}, |
| 82 | Milestone: Ptr(1), |
| 83 | Title: "Dummy Issue", |
| 84 | }, |
| 85 | Comments: []*Comment{{ |
| 86 | CreatedAt: &Timestamp{createdAt}, |
| 87 | Body: "Comment body", |
| 88 | }}, |
| 89 | } |
| 90 | |
| 91 | mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) { |
| 92 | testMethod(t, r, "POST") |
| 93 | testHeader(t, r, "Accept", mediaTypeIssueImportAPI) |
| 94 | testJSONBody(t, r, input) |
| 95 | w.WriteHeader(http.StatusAccepted) |
| 96 | assertWrite(t, w, issueImportResponseJSON) |
| 97 | }) |
| 98 | |
| 99 | ctx := t.Context() |
| 100 | got, _, err := client.IssueImport.Create(ctx, "o", "r", input) |
| 101 | |
| 102 | if !errors.As(err, new(*AcceptedError)) { |
| 103 | t.Errorf("Create returned error: %v (want AcceptedError)", err) |
| 104 | } |
| 105 | |
| 106 | want := wantIssueImportResponse |
| 107 | if !cmp.Equal(got, want) { |
| 108 | t.Errorf("Create = %+v, want %+v", got, want) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | func TestIssueImportService_Create_badResponse(t *testing.T) { |
| 113 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…