MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestRemoteIdentity

Function TestRemoteIdentity

internal/diff/git_resolve_test.go:197–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

195}
196
197func TestRemoteIdentity(t *testing.T) {
198 repo := initBareRepo(t)
199 // No origin remote yet: identity is empty.
200 p := NewWorkspaceProvider(repo, nil)
201 if got := p.RemoteIdentity(context.Background()); got != "" {
202 t.Errorf("RemoteIdentity without origin = %q, want empty", got)
203 }
204 // Add an origin with an embedded credential; identity must be credential-free.
205 runGitTest(t, repo, "remote", "add", "origin", "https://user:secret@example.com/acme/widget.git")
206 if got := p.RemoteIdentity(context.Background()); got != "example.com/acme/widget" {
207 t.Errorf("RemoteIdentity = %q, want %q", got, "example.com/acme/widget")
208 }
209}
210
211func TestResolveInput_UnbornWorkspace(t *testing.T) {
212 repo := initBareRepo(t) // no commits: HEAD is unborn

Callers

nothing calls this directly

Calls 4

initBareRepoFunction · 0.85
NewWorkspaceProviderFunction · 0.85
runGitTestFunction · 0.85
RemoteIdentityMethod · 0.80

Tested by

no test coverage detected