(t *testing.T)
| 720 | } |
| 721 | |
| 722 | func 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 | |
| 746 | func TestRequestAccessTokenUsesConfiguredAppCredentials(t *testing.T) { |
| 747 | restoreOAuthCredentials(t) |
nothing calls this directly
no test coverage detected