(t *testing.T)
| 770 | } |
| 771 | |
| 772 | func TestTokenWorksRightAfterMigration(t *testing.T) { |
| 773 | // Given we have logged in before migration |
| 774 | authCfg := newTestAuthConfig(t) |
| 775 | _, err := preMigrationLogin(authCfg, "github.com", "test-user", "test-token", "ssh", false) |
| 776 | require.NoError(t, err) |
| 777 | |
| 778 | // When we migrate |
| 779 | var m migration.MultiAccountDeprecated |
| 780 | c := cfg{cfg: authCfg.cfg} |
| 781 | require.NoError(t, c.Migrate(m)) |
| 782 | |
| 783 | // Then we can still get the token correctly |
| 784 | cred := authCfg.ActiveToken("github.com") |
| 785 | token, source := cred.Token, cred.Source |
| 786 | require.Equal(t, "test-token", token) |
| 787 | require.Equal(t, oauthTokenKey, source) |
| 788 | } |
| 789 | |
| 790 | func TestTokenPrioritizesActiveUserToken(t *testing.T) { |
| 791 | // Given a keyring where the active slot contains the token from a previous user |
nothing calls this directly
no test coverage detected