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

Function TestHasActiveToken

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

Source from the content-addressed store, hash-verified

66}
67
68func TestHasActiveToken(t *testing.T) {
69 // Given the user has logged in for a host
70 authCfg := newTestAuthConfig(t)
71 _, err := authCfg.Login("github.com", "test-user", "test-token", "", false)
72 require.NoError(t, err)
73
74 // When we check if that host has an active token
75 hasActiveToken := authCfg.HasActiveToken("github.com")
76
77 // Then there is an active token
78 require.True(t, hasActiveToken, "expected there to be an active token")
79}
80
81func TestHasNoActiveToken(t *testing.T) {
82 // Given there are no users logged in for a host

Callers

nothing calls this directly

Calls 3

newTestAuthConfigFunction · 0.85
LoginMethod · 0.65
HasActiveTokenMethod · 0.65

Tested by

no test coverage detected