(t *testing.T)
| 79 | } |
| 80 | |
| 81 | func 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 | |
| 101 | func TestLoginUsesAppKeyFlag(t *testing.T) { |
| 102 | restoreOAuthCredentials(t) |
nothing calls this directly
no test coverage detected