MCPcopy Create free account
hub / github.com/cli/cli / Test_createRun_GHES

Function Test_createRun_GHES

pkg/cmd/pr/create/create_test.go:2121–2638  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2119}
2120
2121func Test_createRun_GHES(t *testing.T) {
2122 tests := []struct {
2123 name string
2124 setup func(*CreateOptions, *testing.T) func()
2125 cmdStubs func(*run.CommandStubber)
2126 promptStubs func(*prompter.PrompterMock)
2127 httpStubs func(*httpmock.Registry, *testing.T)
2128 expectedOutputs []string
2129 expectedOut string
2130 expectedErrOut string
2131 tty bool
2132 customBranchConfig bool
2133 }{
2134 {
2135 name: "dry-run-nontty-with-all-opts",
2136 tty: false,
2137 setup: func(opts *CreateOptions, t *testing.T) func() {
2138 opts.TitleProvided = true
2139 opts.BodyProvided = true
2140 opts.Title = "TITLE"
2141 opts.Body = "BODY"
2142 opts.BaseBranch = "trunk"
2143 opts.HeadBranch = "feature"
2144 opts.Assignees = []string{"monalisa"}
2145 opts.Labels = []string{"bug", "todo"}
2146 opts.Reviewers = []string{"hubot", "monalisa", "OWNER/core", "OWNER/robots"}
2147 opts.Milestone = "big one.oh"
2148 opts.DryRun = true
2149 return func() {}
2150 },
2151 httpStubs: func(reg *httpmock.Registry, t *testing.T) {
2152 reg.Register(
2153 httpmock.GraphQL(`query UserCurrent\b`),
2154 httpmock.StringResponse(`{"data": {"viewer": {"login": "OWNER"} } }`))
2155 reg.Register(
2156 httpmock.GraphQL(`query RepositoryAssignableUsers\b`),
2157 httpmock.StringResponse(`
2158 { "data": { "repository": { "assignableUsers": {
2159 "nodes": [
2160 { "login": "hubot", "id": "HUBOTID", "name": "" },
2161 { "login": "MonaLisa", "id": "MONAID", "name": "Mona Display Name" }
2162 ],
2163 "pageInfo": { "hasNextPage": false }
2164 } } } }
2165 `))
2166 reg.Register(
2167 httpmock.GraphQL(`query RepositoryLabelList\b`),
2168 httpmock.StringResponse(`
2169 { "data": { "repository": { "labels": {
2170 "nodes": [
2171 { "name": "TODO", "id": "TODOID" },
2172 { "name": "bug", "id": "BUGID" }
2173 ],
2174 "pageInfo": { "hasNextPage": false }
2175 } } } }
2176 `))
2177 reg.Register(
2178 httpmock.GraphQL(`query RepositoryMilestoneList\b`),

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
ExcludeMethod · 0.95
StubRepoInfoResponseMethod · 0.95
VerifyMethod · 0.95
StringMethod · 0.95
StderrMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLMutationFunction · 0.92
IndexesForFunction · 0.92
IndexForFunction · 0.92
StubFunction · 0.92

Tested by

no test coverage detected