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

Function TestRemoteIdentity

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

Source from the content-addressed store, hash-verified

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