(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestCommandRequiresAuthentication(t *testing.T) { |
| 30 | var testCases = []struct { |
| 31 | givenCommand string |
| 32 | expectedToRequireAuthentication bool |
| 33 | }{ |
| 34 | {"auth0 user list", true}, |
| 35 | {"auth0 user create", true}, |
| 36 | {"auth0 api", true}, |
| 37 | {"auth0 apps list", true}, |
| 38 | {"auth0 apps create", true}, |
| 39 | {"auth0 orgs members list", true}, |
| 40 | {"auth0 completion", false}, |
| 41 | {"auth0 help", false}, |
| 42 | {"auth0 login", false}, |
| 43 | {"auth0 logout", false}, |
| 44 | {"auth0 tenants use", false}, |
| 45 | {"auth0 tenants list", false}, |
| 46 | } |
| 47 | |
| 48 | for index, testCase := range testCases { |
| 49 | t.Run(fmt.Sprintf("TestCase #%d Command: %s", index, testCase.givenCommand), func(t *testing.T) { |
| 50 | actualAuth := commandRequiresAuthentication(testCase.givenCommand) |
| 51 | assert.Equal(t, testCase.expectedToRequireAuthentication, actualAuth) |
| 52 | }) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func TestClassifyCommandFailure(t *testing.T) { |
| 57 | t.Run("classifies 401 and 403 management errors as auth", func(t *testing.T) { |
nothing calls this directly
no test coverage detected