MCPcopy Index your code
hub / github.com/cli/cli / Test_repoCreate

Function Test_repoCreate

pkg/cmd/repo/create/http_test.go:12–750  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func Test_repoCreate(t *testing.T) {
13 tests := []struct {
14 name string
15 hostname string
16 input repoCreateInput
17 stubs func(t *testing.T, r *httpmock.Registry)
18 wantErr bool
19 errMsg string
20 wantRepo string
21 }{
22 {
23 name: "create personal repository",
24 hostname: "github.com",
25 input: repoCreateInput{
26 Name: "winter-foods",
27 Description: "roasted chestnuts",
28 HomepageURL: "http://example.com",
29 Visibility: "public",
30 HasIssuesEnabled: true,
31 HasWikiEnabled: true,
32 },
33 stubs: func(t *testing.T, r *httpmock.Registry) {
34 r.Register(
35 httpmock.GraphQL(`mutation RepositoryCreate\b`),
36 httpmock.GraphQLMutation(
37 `{
38 "data": {
39 "createRepository": {
40 "repository": {
41 "id": "REPOID",
42 "name": "REPO",
43 "owner": {"login":"OWNER"},
44 "url": "the://URL"
45 }
46 }
47 }
48 }`,
49 func(inputs map[string]interface{}) {
50 assert.Equal(t, map[string]interface{}{
51 "name": "winter-foods",
52 "description": "roasted chestnuts",
53 "homepageUrl": "http://example.com",
54 "visibility": "PUBLIC",
55 "hasIssuesEnabled": true,
56 "hasWikiEnabled": true,
57 }, inputs)
58 }),
59 )
60 },
61 wantRepo: "https://github.com/OWNER/REPO",
62 },
63 {
64 name: "create Enterprise repository",
65 hostname: "example.com",
66 input: repoCreateInput{
67 Name: "winter-foods",
68 Description: "roasted chestnuts",
69 HomepageURL: "http://example.com",

Callers

nothing calls this directly

Calls 13

VerifyMethod · 0.95
GraphQLFunction · 0.92
GraphQLMutationFunction · 0.92
RESTFunction · 0.92
StringResponseFunction · 0.92
RESTPayloadFunction · 0.92
GenerateRepoURLFunction · 0.92
repoCreateFunction · 0.85
EqualMethod · 0.80
ExcludeMethod · 0.80
RunMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected