(t *testing.T)
| 120 | } |
| 121 | |
| 122 | func TestTokenStoredInKeyring(t *testing.T) { |
| 123 | // When the user has logged in securely |
| 124 | authCfg := newTestAuthConfig(t) |
| 125 | _, err := authCfg.Login("github.com", "test-user", "test-token", "", true) |
| 126 | require.NoError(t, err) |
| 127 | |
| 128 | // When we get the token |
| 129 | cred := authCfg.ActiveToken("github.com") |
| 130 | token, source := cred.Token, cred.Source |
| 131 | |
| 132 | // Then the token is successfully fetched |
| 133 | // and the source is set to keyring |
| 134 | require.Equal(t, "test-token", token) |
| 135 | require.Equal(t, "keyring", source) |
| 136 | } |
| 137 | |
| 138 | func TestTokenFromKeyringNonExistent(t *testing.T) { |
| 139 | // Given a keyring that doesn't contain any tokens |
nothing calls this directly
no test coverage detected