(t *testing.T)
| 212 | } |
| 213 | |
| 214 | func TestScope(t *testing.T) { |
| 215 | g := NewWithT(t) |
| 216 | |
| 217 | testCases := []struct { |
| 218 | name string |
| 219 | configuredType options.ProviderType |
| 220 | configuredScope string |
| 221 | expectedScope string |
| 222 | allowedGroups []string |
| 223 | }{ |
| 224 | { |
| 225 | name: "oidc: with no scope provided", |
| 226 | configuredType: "oidc", |
| 227 | configuredScope: "", |
| 228 | expectedScope: "openid email profile", |
| 229 | }, |
| 230 | { |
| 231 | name: "oidc: with no scope provided and allowed groups", |
| 232 | configuredType: "oidc", |
| 233 | configuredScope: "", |
| 234 | expectedScope: "openid email profile groups", |
| 235 | allowedGroups: []string{"foo"}, |
| 236 | }, |
| 237 | { |
| 238 | name: "oidc: with custom scope including groups without allowed groups", |
| 239 | configuredType: "oidc", |
| 240 | configuredScope: "myscope groups", |
| 241 | expectedScope: "myscope groups", |
| 242 | }, |
| 243 | { |
| 244 | name: "oidc: with custom scope without groups but allowed groups", |
| 245 | configuredType: "oidc", |
| 246 | configuredScope: "myscope", |
| 247 | expectedScope: "myscope", |
| 248 | allowedGroups: []string{"foo"}, |
| 249 | }, |
| 250 | { |
| 251 | name: "oidc: with custom scope with groups and allowed groups", |
| 252 | configuredType: "oidc", |
| 253 | configuredScope: "myscope groups", |
| 254 | expectedScope: "myscope groups", |
| 255 | allowedGroups: []string{"foo"}, |
| 256 | }, |
| 257 | { |
| 258 | name: "oidc: with a configured scope provided", |
| 259 | configuredType: "oidc", |
| 260 | configuredScope: "openid", |
| 261 | expectedScope: "openid", |
| 262 | }, |
| 263 | { |
| 264 | name: "github: with no scope provided", |
| 265 | configuredType: "github", |
| 266 | configuredScope: "", |
| 267 | expectedScope: "user:email read:org", |
| 268 | }, |
| 269 | { |
| 270 | name: "github: with a configured scope provided", |
| 271 | configuredType: "github", |
nothing calls this directly
no test coverage detected