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

Function TestIssueImportService_Create

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

Source from the content-addressed store, hash-verified

16)
17
18func TestIssueImportService_Create(t *testing.T) {
19 t.Parallel()
20 client, mux, _ := setup(t)
21
22 createdAt := time.Date(2020, time.August, 11, 15, 30, 0, 0, time.UTC)
23 input := &IssueImportRequest{
24 IssueImport: IssueImport{
25 Assignee: Ptr("developer"),
26 Body: "Dummy description",
27 CreatedAt: &Timestamp{createdAt},
28 Labels: []string{"l1", "l2"},
29 Milestone: Ptr(1),
30 Title: "Dummy Issue",
31 },
32 Comments: []*Comment{{
33 CreatedAt: &Timestamp{createdAt},
34 Body: "Comment body",
35 }},
36 }
37
38 mux.HandleFunc("/repos/o/r/import/issues", func(w http.ResponseWriter, r *http.Request) {
39 testMethod(t, r, "POST")
40 testHeader(t, r, "Accept", mediaTypeIssueImportAPI)
41 testJSONBody(t, r, input)
42 assertWrite(t, w, issueImportResponseJSON)
43 })
44
45 ctx := t.Context()
46 got, _, err := client.IssueImport.Create(ctx, "o", "r", input)
47 if err != nil {
48 t.Errorf("Create returned error: %v", err)
49 }
50
51 want := wantIssueImportResponse
52 if !cmp.Equal(got, want) {
53 t.Errorf("Create = %+v, want %+v", got, want)
54 }
55
56 const methodName = "Create"
57 testBadOptions(t, methodName, func() (err error) {
58 _, _, err = client.IssueImport.Create(ctx, "\n", "\n", input)
59 return err
60 })
61
62 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
63 got, resp, err := client.IssueImport.Create(ctx, "o", "r", input)
64 if got != nil {
65 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
66 }
67 return resp, err
68 })
69}
70
71func TestIssueImportService_Create_deferred(t *testing.T) {
72 t.Parallel()

Callers

nothing calls this directly

Calls 10

testMethodFunction · 0.85
testHeaderFunction · 0.85
testJSONBodyFunction · 0.85
assertWriteFunction · 0.85
testBadOptionsFunction · 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…