MCPcopy Index your code
hub / github.com/google/go-github / TestIssueImportService_Create_deferred

Function TestIssueImportService_Create_deferred

github/issue_import_test.go:71–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func 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
112func TestIssueImportService_Create_badResponse(t *testing.T) {
113 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testHeaderFunction · 0.85
testJSONBodyFunction · 0.85
assertWriteFunction · 0.85
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70
CreateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…