(t *testing.T)
| 29 | ) |
| 30 | |
| 31 | func TestGithubTokenPermissions(t *testing.T) { |
| 32 | t.Parallel() |
| 33 | |
| 34 | tests := []struct { |
| 35 | name string |
| 36 | filenames []string |
| 37 | expected scut.TestReturn |
| 38 | }{ |
| 39 | { |
| 40 | name: "run workflow codeql write test", |
| 41 | filenames: []string{"./testdata/.github/workflows/github-workflow-permissions-run-codeql-write.yaml"}, |
| 42 | expected: scut.TestReturn{ |
| 43 | Error: nil, |
| 44 | Score: checker.MaxResultScore, |
| 45 | NumberOfWarn: 0, |
| 46 | NumberOfInfo: 2, |
| 47 | NumberOfDebug: 5, |
| 48 | }, |
| 49 | }, |
| 50 | { |
| 51 | name: "run workflow no codeql write test", |
| 52 | filenames: []string{"./testdata/.github/workflows/github-workflow-permissions-run-no-codeql-write.yaml"}, |
| 53 | expected: scut.TestReturn{ |
| 54 | Error: nil, |
| 55 | Score: checker.MaxResultScore, |
| 56 | NumberOfWarn: 1, |
| 57 | NumberOfInfo: 1, |
| 58 | NumberOfDebug: 4, |
| 59 | }, |
| 60 | }, |
| 61 | { |
| 62 | name: "run workflow write test", |
| 63 | filenames: []string{"./testdata/.github/workflows/github-workflow-permissions-run-writes-2.yaml"}, |
| 64 | expected: scut.TestReturn{ |
| 65 | Error: nil, |
| 66 | Score: checker.MaxResultScore, |
| 67 | NumberOfWarn: 3, |
| 68 | NumberOfInfo: 2, |
| 69 | NumberOfDebug: 4, |
| 70 | }, |
| 71 | }, |
| 72 | { |
| 73 | name: "run package workflow write test", |
| 74 | filenames: []string{"./testdata/.github/workflows/github-workflow-permissions-run-package-workflow-write.yaml"}, |
| 75 | expected: scut.TestReturn{ |
| 76 | Error: nil, |
| 77 | Score: checker.MaxResultScore, |
| 78 | NumberOfWarn: 0, |
| 79 | NumberOfInfo: 2, |
| 80 | NumberOfDebug: 5, |
| 81 | }, |
| 82 | }, |
| 83 | { |
| 84 | name: "run package write test", |
| 85 | filenames: []string{"./testdata/.github/workflows/github-workflow-permissions-run-package-write.yaml"}, |
| 86 | expected: scut.TestReturn{ |
| 87 | Error: nil, |
| 88 | Score: checker.MaxResultScore, |
nothing calls this directly
no test coverage detected