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

Function Test_createRun_GHES

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

Source from the content-addressed store, hash-verified

2081}
2082
2083func Test_createRun_GHES(t *testing.T) {
2084 tests := []struct {
2085 name string
2086 setup func(*CreateOptions, *testing.T) func()
2087 cmdStubs func(*run.CommandStubber)
2088 promptStubs func(*prompter.PrompterMock)
2089 httpStubs func(*httpmock.Registry, *testing.T)
2090 expectedOutputs []string
2091 expectedOut string
2092 expectedErrOut string
2093 tty bool
2094 customBranchConfig bool
2095 }{
2096 {
2097 name: "dry-run-nontty-with-all-opts",
2098 tty: false,
2099 setup: func(opts *CreateOptions, t *testing.T) func() {
2100 opts.TitleProvided = true
2101 opts.BodyProvided = true
2102 opts.Title = "TITLE"
2103 opts.Body = "BODY"
2104 opts.BaseBranch = "trunk"
2105 opts.HeadBranch = "feature"
2106 opts.Assignees = []string{"monalisa"}
2107 opts.Labels = []string{"bug", "todo"}
2108 opts.Reviewers = []string{"hubot", "monalisa", "OWNER/core", "OWNER/robots"}
2109 opts.Milestone = "big one.oh"
2110 opts.DryRun = true
2111 return func() {}
2112 },
2113 httpStubs: func(reg *httpmock.Registry, t *testing.T) {
2114 reg.Register(
2115 httpmock.GraphQL(`query UserCurrent\b`),
2116 httpmock.StringResponse(`{"data": {"viewer": {"login": "OWNER"} } }`))
2117 reg.Register(
2118 httpmock.GraphQL(`query RepositoryAssignableUsers\b`),
2119 httpmock.StringResponse(`
2120 { "data": { "repository": { "assignableUsers": {
2121 "nodes": [
2122 { "login": "hubot", "id": "HUBOTID", "name": "" },
2123 { "login": "MonaLisa", "id": "MONAID", "name": "Mona Display Name" }
2124 ],
2125 "pageInfo": { "hasNextPage": false }
2126 } } } }
2127 `))
2128 reg.Register(
2129 httpmock.GraphQL(`query RepositoryLabelList\b`),
2130 httpmock.StringResponse(`
2131 { "data": { "repository": { "labels": {
2132 "nodes": [
2133 { "name": "TODO", "id": "TODOID" },
2134 { "name": "bug", "id": "BUGID" }
2135 ],
2136 "pageInfo": { "hasNextPage": false }
2137 } } } }
2138 `))
2139 reg.Register(
2140 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