MCPcopy Create free account
hub / github.com/cli/cli / TestLoginInsecureStorage

Function TestLoginInsecureStorage

internal/config/auth_config_test.go:290–302  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

288}
289
290func TestLoginInsecureStorage(t *testing.T) {
291 // Given we are not logged in
292 authCfg := newTestAuthConfig(t)
293
294 // When we login with insecure storage
295 insecureStorageUsed, err := authCfg.Login("github.com", "test-user", "test-token", "", false)
296
297 // Then it returns success, notes that insecure storage was used, and stores the token in the config
298 require.NoError(t, err)
299
300 require.True(t, insecureStorageUsed, "expected to use insecure storage")
301 requireKeyWithValue(t, authCfg.cfg, []string{hostsKey, "github.com", oauthTokenKey}, "test-token")
302}
303
304func TestLoginSetsUserForProvidedHost(t *testing.T) {
305 // Given we are not logged in

Callers

nothing calls this directly

Calls 3

newTestAuthConfigFunction · 0.85
requireKeyWithValueFunction · 0.70
LoginMethod · 0.65

Tested by

no test coverage detected