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

Function TestUpdateAddsNewCredentials

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

Source from the content-addressed store, hash-verified

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

Tested by

no test coverage detected