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

Function TestLoginInsecureStorage

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

Source from the content-addressed store, hash-verified

301}
302
303func TestLoginInsecureStorage(t *testing.T) {
304 // Given we are not logged in
305 authCfg := newTestAuthConfig(t)
306
307 // When we login with insecure storage
308 insecureStorageUsed, err := authCfg.Login("github.com", "test-user", "test-token", "", false)
309
310 // Then it returns success, notes that insecure storage was used, and stores the token in the config
311 require.NoError(t, err)
312
313 require.True(t, insecureStorageUsed, "expected to use insecure storage")
314 requireKeyWithValue(t, authCfg.cfg, []string{hostsKey, "github.com", oauthTokenKey}, "test-token")
315}
316
317func TestLoginSetsUserForProvidedHost(t *testing.T) {
318 // 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