(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func TestEditProjectHook(t *testing.T) { |
| 27 | tt := []struct { |
| 28 | name string |
| 29 | flagsMap map[string]string |
| 30 | args []string |
| 31 | expect testResult |
| 32 | }{ |
| 33 | { |
| 34 | name: "edit an existing project hook by project path", |
| 35 | flagsMap: map[string]string{ |
| 36 | "project": "frank.watson/project22", |
| 37 | "url": "http://example1.com/", |
| 38 | "push-events": "false", |
| 39 | "issues-events": "false", |
| 40 | "confidential-issues-events": "true", |
| 41 | "merge-requests-events": "false", |
| 42 | "tag-push-events": "false", |
| 43 | "note-events": "true", |
| 44 | "job-events": "true", |
| 45 | "pipeline-events": "true", |
| 46 | "wiki-page-events": "true", |
| 47 | "enable-ssl-verification": "true", |
| 48 | "token": "gAWLwCxxK5ss0z6PzgpS", |
| 49 | }, |
| 50 | args: []string{"4"}, |
| 51 | expect: pass, |
| 52 | }, |
| 53 | { |
| 54 | name: "edit an existing project hook by project id", |
| 55 | flagsMap: map[string]string{ |
| 56 | "project": "23", |
| 57 | "url": "http://example2.com/", |
| 58 | "push-events": "false", |
| 59 | "issues-events": "false", |
| 60 | "confidential-issues-events": "true", |
| 61 | "merge-requests-events": "false", |
| 62 | "tag-push-events": "false", |
| 63 | "note-events": "true", |
| 64 | "job-events": "true", |
| 65 | "pipeline-events": "true", |
| 66 | "wiki-page-events": "true", |
| 67 | "enable-ssl-verification": "true", |
| 68 | "token": "EKdYF9AvxRWKlch0XBKO", |
| 69 | }, |
| 70 | args: []string{"5"}, |
| 71 | expect: pass, |
| 72 | }, |
| 73 | } |
| 74 | |
| 75 | for _, tc := range tt { |
| 76 | t.Run(tc.name, func(t *testing.T) { |
| 77 | execT := execTestCmdFlags{ |
| 78 | t: t, |
| 79 | cmd: editProjectHookCmd, |
| 80 | flagsMap: tc.flagsMap, |
| 81 | args: tc.args, |
| 82 | } |
| 83 | stdout, execResult := execT.executeCommand() |
nothing calls this directly
no test coverage detected