-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix logic that permits some commands to run without auth (#741)
- Loading branch information
Showing
2 changed files
with
59 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCommandRequiresAuthentication(t *testing.T) { | ||
var testCases = []struct { | ||
givenCommand string | ||
expectedToRequireAuthentication bool | ||
}{ | ||
{"auth0 user list", true}, | ||
{"auth0 user create", true}, | ||
{"auth0 api", true}, | ||
{"auth0 apps list", true}, | ||
{"auth0 apps create", true}, | ||
{"auth0 orgs members list", true}, | ||
{"auth0 completion", false}, | ||
{"auth0 help", false}, | ||
{"auth0 login", false}, | ||
{"auth0 logout", false}, | ||
{"auth0 tenants use", false}, | ||
{"auth0 tenants list", false}, | ||
} | ||
|
||
for index, testCase := range testCases { | ||
t.Run(fmt.Sprintf("TestCase #%d Command: %s", index, testCase.givenCommand), func(t *testing.T) { | ||
actualAuth := commandRequiresAuthentication(testCase.givenCommand) | ||
assert.Equal(t, testCase.expectedToRequireAuthentication, actualAuth) | ||
}) | ||
} | ||
} |