MCPcopy Create free account
hub / github.com/dropbox/dbxcli / TestLoginWritesSelectedTokenType

Function TestLoginWritesSelectedTokenType

cmd/login_test.go:81–99  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

79}
80
81func TestLoginWritesSelectedTokenType(t *testing.T) {
82 authFile := filepath.Join(t.TempDir(), "auth.json")
83 t.Setenv(envAuthFile, authFile)
84 mockAuthorization(t, "auth-code", "team-token")
85
86 cmd := newLoginTestCommand()
87
88 if err := login(cmd, []string{"team-manage"}); err != nil {
89 t.Fatal(err)
90 }
91
92 tokens, err := readTokens(authFile)
93 if err != nil {
94 t.Fatal(err)
95 }
96 if tokens[""][tokenTeamManage].AccessToken != "team-token" {
97 t.Fatalf("expected team manage token to be saved, got %q", tokens[""][tokenTeamManage].AccessToken)
98 }
99}
100
101func TestLoginUsesAppKeyFlag(t *testing.T) {
102 restoreOAuthCredentials(t)

Callers

nothing calls this directly

Calls 4

mockAuthorizationFunction · 0.85
newLoginTestCommandFunction · 0.85
loginFunction · 0.85
readTokensFunction · 0.85

Tested by

no test coverage detected