(t *testing.T)
| 73 | } |
| 74 | |
| 75 | func TestIsAuthError(t *testing.T) { |
| 76 | tests := []struct { |
| 77 | name string |
| 78 | errMsg string |
| 79 | expected bool |
| 80 | }{ |
| 81 | { |
| 82 | name: "GH_TOKEN mention", |
| 83 | errMsg: "GH_TOKEN is not set", |
| 84 | expected: true, |
| 85 | }, |
| 86 | { |
| 87 | name: "GITHUB_TOKEN mention", |
| 88 | errMsg: "GITHUB_TOKEN is missing or invalid", |
| 89 | expected: true, |
| 90 | }, |
| 91 | { |
| 92 | name: "authentication error", |
| 93 | errMsg: "authentication required", |
| 94 | expected: true, |
| 95 | }, |
| 96 | { |
| 97 | name: "not logged in", |
| 98 | errMsg: "not logged into any GitHub hosts", |
| 99 | expected: true, |
| 100 | }, |
| 101 | { |
| 102 | name: "unauthorized", |
| 103 | errMsg: "HTTP 401: Unauthorized", |
| 104 | expected: true, |
| 105 | }, |
| 106 | { |
| 107 | name: "forbidden", |
| 108 | errMsg: "HTTP 403: Forbidden", |
| 109 | expected: true, |
| 110 | }, |
| 111 | { |
| 112 | name: "permission denied", |
| 113 | errMsg: "permission denied: insufficient scope", |
| 114 | expected: true, |
| 115 | }, |
| 116 | { |
| 117 | name: "saml enforcement", |
| 118 | errMsg: "Resource protected by organization SAML enforcement", |
| 119 | expected: true, |
| 120 | }, |
| 121 | { |
| 122 | name: "rate limit error is not an auth error", |
| 123 | errMsg: "API rate limit exceeded for installation", |
| 124 | expected: false, |
| 125 | }, |
| 126 | { |
| 127 | name: "empty string", |
| 128 | errMsg: "", |
| 129 | expected: false, |
| 130 | }, |
| 131 | } |
| 132 |
nothing calls this directly
no test coverage detected