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

Function TestReadAppCredentialsReadsVisibleKey

cmd/auth_test.go:722–744  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

720}
721
722func TestReadAppCredentialsReadsVisibleKey(t *testing.T) {
723 restoreOAuthCredentials(t)
724
725 var keyPrompts []string
726 readAppKey = func(prompt string) (string, error) {
727 keyPrompts = append(keyPrompts, prompt)
728 return "visible-key", nil
729 }
730
731 creds, err := readAppCredentials(tokenPersonal)
732 if err != nil {
733 t.Fatal(err)
734 }
735 if creds.Key != "visible-key" {
736 t.Fatalf("expected app key, got %q", creds.Key)
737 }
738 if len(keyPrompts) != 1 {
739 t.Fatalf("expected one app key prompt, got %d", len(keyPrompts))
740 }
741 if keyPrompts[0] != "Dropbox app key: " {
742 t.Fatalf("unexpected app key prompt %q", keyPrompts[0])
743 }
744}
745
746func TestRequestAccessTokenUsesConfiguredAppCredentials(t *testing.T) {
747 restoreOAuthCredentials(t)

Callers

nothing calls this directly

Calls 1

restoreOAuthCredentialsFunction · 0.85

Tested by

no test coverage detected