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

Function TestSetup_setOurs_nonGH

pkg/cmd/auth/shared/git_credential_test.go:167–198  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

165}
166
167func TestSetup_setOurs_nonGH(t *testing.T) {
168 cs, restoreRun := run.Stub()
169 defer restoreRun(t)
170 cs.Register(`git config --global --replace-all credential\.`, 0, "", func(args []string) {
171 if key := args[len(args)-2]; key != "credential.https://example.com.helper" {
172 t.Errorf("git config key was %q", key)
173 }
174 if val := args[len(args)-1]; val != "" {
175 t.Errorf("global credential helper configured to %q", val)
176 }
177 })
178 cs.Register(`git config --global --add credential\.`, 0, "", func(args []string) {
179 if key := args[len(args)-2]; key != "credential.https://example.com.helper" {
180 t.Errorf("git config key was %q", key)
181 }
182 if val := args[len(args)-1]; val != "!/path/to/gh auth git-credential" {
183 t.Errorf("global credential helper configured to %q", val)
184 }
185 })
186
187 f := GitCredentialFlow{
188 helper: gitcredentials.Helper{},
189 HelperConfig: &gitcredentials.HelperConfig{
190 SelfExecutablePath: "/path/to/gh",
191 GitClient: &git.Client{GitPath: "some/path/git"},
192 },
193 }
194
195 if _, err := f.Setup("example.com", "monalisa", "PASSWD", false); err != nil {
196 t.Errorf("Setup() error = %v", err)
197 }
198}
199
200func TestPrompt_expiring_configure(t *testing.T) {
201 var gotMessage string

Callers

nothing calls this directly

Calls 4

SetupMethod · 0.95
StubFunction · 0.92
ErrorfMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected