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

Function TestIssueImportService_Create_badResponse

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

Source from the content-addressed store, hash-verified

110}
111
112func 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
148func TestIssueImportService_Create_invalidOwner(t *testing.T) {
149 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testHeaderFunction · 0.85
testJSONBodyFunction · 0.85
assertWriteFunction · 0.85
setupFunction · 0.70
PtrFunction · 0.70
CreateMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…