MCPcopy Index your code
hub / github.com/devopsctl/gitlabctl / TestNewProject

Function TestNewProject

cmd/new_project_test.go:30–121  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNewProject(t *testing.T) {
31 tt := []struct {
32 name string
33 flagsMap map[string]string
34 args []string
35 expect testResult
36 }{
37 {
38 name: "create a new project using all flags",
39 flagsMap: map[string]string{
40 "namespace": "Group1",
41 "desc": "Created by go test",
42 "issues-enabled": "true",
43 "merge-requests-enabled": "true",
44 "jobs-enabled": "true",
45 "wiki-enabled": "true",
46 "snippets-enabled": "true",
47 "resolve-outdated-diff-discussions": "true",
48 "container-registry-enabled": "true",
49 "shared-runners-enabled": "true",
50 "visibility": "private",
51 "public-jobs": "true",
52 "only-allow-merge-if-pipeline-succeeds": "true",
53 "only-allow-merge-if-discussion-are-resolved": "true",
54 "merge-method": "rebase_merge",
55 "lfs-enabled": "true",
56 "request-access-enabled": "true",
57 "tag-list": "gotest,tdd",
58 "printing-merge-request-link-enabled": "true",
59 "ci-config-path": "gitlabci.yml",
60 "out": "json",
61 },
62 args: []string{"ProjectX"},
63 expect: pass,
64 },
65 {
66 name: "invalid visibility value should fail",
67 flagsMap: map[string]string{
68 "visibility": "xxxx",
69 },
70 args: []string{"ProjectY"},
71 expect: fail,
72 },
73 {
74 name: "invalid merge method value should fail",
75 flagsMap: map[string]string{
76 // fix the visibility value from above tc
77 "visibility": "private",
78 "merge-method": "xxxx",
79 },
80 args: []string{"ProjectZ"},
81 expect: fail,
82 },
83 }
84
85 for _, tc := range tt {
86 t.Run(tc.name, func(t *testing.T) {
87 execT := execTestCmdFlags{

Callers

nothing calls this directly

Calls 4

executeCommandMethod · 0.95
tInfoFunction · 0.85
printFlagsTableFunction · 0.85
deleteProjectFunction · 0.85

Tested by

no test coverage detected