MCPcopy
hub / github.com/cli/cli / TestLoginInsecureStorage

Function TestLoginInsecureStorage

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

Source from the content-addressed store, hash-verified

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