(t *testing.T)
| 27 | ) |
| 28 | |
| 29 | func TestEditProject(t *testing.T) { |
| 30 | tt := []struct { |
| 31 | name string |
| 32 | flagsMap map[string]string |
| 33 | args []string |
| 34 | expect testResult |
| 35 | }{ |
| 36 | { |
| 37 | name: "edit an existing project using all flags", |
| 38 | flagsMap: map[string]string{ |
| 39 | "desc": "Updated by go test", |
| 40 | "issues-enabled": "false", |
| 41 | "merge-requests-enabled": "false", |
| 42 | "jobs-enabled": "false", |
| 43 | "wiki-enabled": "false", |
| 44 | "snippets-enabled": "false", |
| 45 | "resolve-outdated-diff-discussions": "false", |
| 46 | "container-registry-enabled": "false", |
| 47 | "shared-runners-enabled": "false", |
| 48 | "visibility": "private", |
| 49 | "public-jobs": "false", |
| 50 | "only-allow-merge-if-pipeline-succeeds": "true", |
| 51 | "only-allow-merge-if-discussion-are-resolved": "true", |
| 52 | "merge-method": "ff", |
| 53 | "lfs-enabled": "false", |
| 54 | "request-access-enabled": "false", |
| 55 | "tag-list": "patched,gotest,tdd", |
| 56 | "printing-merge-request-link-enabled": "true", |
| 57 | "ci-config-path": "xgitlabci.yml", |
| 58 | "out": "json", |
| 59 | }, |
| 60 | args: []string{"Group2/project12"}, |
| 61 | expect: pass, |
| 62 | }, |
| 63 | { |
| 64 | name: "update a project by id", |
| 65 | flagsMap: map[string]string{ |
| 66 | "desc": "updated by using id", |
| 67 | "name": "Project 4", |
| 68 | "out": "json", |
| 69 | }, |
| 70 | args: []string{"4"}, |
| 71 | expect: pass, |
| 72 | }, |
| 73 | { |
| 74 | name: "invalid visibility value should fail", |
| 75 | flagsMap: map[string]string{ |
| 76 | "visibility": "xxxx", |
| 77 | }, |
| 78 | args: []string{"ProjectY"}, |
| 79 | expect: fail, |
| 80 | }, |
| 81 | { |
| 82 | name: "invalid merge method value should fail", |
| 83 | flagsMap: map[string]string{ |
| 84 | // fix the visibility value from above tc |
| 85 | "visibility": "private", |
| 86 | "merge-method": "xxxx", |
nothing calls this directly
no test coverage detected