MCPcopy
hub / github.com/cli/cli / TestUpdateAddsNewCredentials

Function TestUpdateAddsNewCredentials

pkg/cmd/auth/shared/gitcredentials/updater_test.go:43–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestUpdateAddsNewCredentials(t *testing.T) {
44 // Given we have an isolated git config and we're using the built in store credential helper
45 // https://git-scm.com/docs/git-credential-store
46 withIsolatedGitConfig(t)
47 configureStoreCredentialHelper(t)
48
49 // When we add new credentials
50 u := &gitcredentials.Updater{
51 GitClient: &git.Client{},
52 }
53 require.NoError(t, u.Update("github.com", "monalisa", "password"))
54
55 // Then our credential description is successfully filled
56 require.Equal(t, heredoc.Doc(`
57protocol=https
58host=github.com
59username=monalisa
60password=password
61`), fillCredentials(t))
62}
63
64func TestUpdateReplacesOldCredentials(t *testing.T) {
65 // Given we have an isolated git config and we're using the built in store credential helper

Callers

nothing calls this directly

Calls 5

UpdateMethod · 0.95
withIsolatedGitConfigFunction · 0.85
fillCredentialsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected