(t *testing.T)
| 1023 | } |
| 1024 | |
| 1025 | func TestIssueCreate(t *testing.T) { |
| 1026 | http := &httpmock.Registry{} |
| 1027 | defer http.Verify(t) |
| 1028 | |
| 1029 | http.Register( |
| 1030 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1031 | httpmock.StringResponse(` |
| 1032 | { "data": { "repository": { |
| 1033 | "id": "REPOID", |
| 1034 | "hasIssuesEnabled": true |
| 1035 | } } }`), |
| 1036 | ) |
| 1037 | http.Register( |
| 1038 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1039 | httpmock.GraphQLMutation(` |
| 1040 | { "data": { "createIssue": { "issue": { |
| 1041 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1042 | } } } }`, |
| 1043 | func(inputs map[string]interface{}) { |
| 1044 | assert.Equal(t, inputs["repositoryId"], "REPOID") |
| 1045 | assert.Equal(t, inputs["title"], "hello") |
| 1046 | assert.Equal(t, inputs["body"], "cash rules everything around me") |
| 1047 | }), |
| 1048 | ) |
| 1049 | |
| 1050 | output, err := runCommand(http, true, `-t hello -b "cash rules everything around me"`, nil) |
| 1051 | if err != nil { |
| 1052 | t.Errorf("error running command `issue create`: %v", err) |
| 1053 | } |
| 1054 | |
| 1055 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1056 | } |
| 1057 | |
| 1058 | func TestIssueCreate_recover(t *testing.T) { |
| 1059 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected