MCPcopy Create free account
hub / github.com/auth0/auth0-cli / TestCommandRequiresAuthentication

Function TestCommandRequiresAuthentication

internal/cli/root_test.go:29–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func 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
56func TestClassifyCommandFailure(t *testing.T) {
57 t.Run("classifies 401 and 403 management errors as auth", func(t *testing.T) {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected