MCPcopy Create free account
hub / github.com/cloudflare/artifact-fs / TestAddRepoAsyncCLIFlagValidation

Function TestAddRepoAsyncCLIFlagValidation

internal/cli/cli_test.go:94–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92 "--refresh", "never",
93 "--async",
94 }, &stdout, &stderr)
95 if code != 0 {
96 t.Fatalf("Run exit = %d, stderr=%q", code, stderr.String())
97 }
98 if got := stdout.String(); got != "queued repo\n" {
99 t.Fatalf("stdout = %q, want queued repo", got)
100 }
101
102 stdout.Reset()
103 stderr.Reset()
104 code = Run(context.Background(), []string{"list-repos"}, &stdout, &stderr)
105 if code != 0 {
106 t.Fatalf("list-repos exit = %d, stderr=%q", code, stderr.String())
107 }
108 if got := stdout.String(); !strings.HasPrefix(got, "repo\tmain\t") {
109 t.Fatalf("list-repos output = %q, want legacy short branch column", got)
110 }
111}
112
113func TestAddRepoAsyncCLIFlagValidation(t *testing.T) {
114 tests := []struct {
115 name string
116 args []string
117 want string
118 }{
119 {
120 name: "prepared_gitdir_requires_async",
121 args: []string{"add-repo", "--name", "repo", "--prepared-gitdir", "--git-dir", "/tmp/repo.git"},
122 want: "--prepared-gitdir requires --async",
123 },
124 {
125 name: "prepared_gitdir_requires_git_dir",
126 args: []string{"add-repo", "--name", "repo", "--async", "--prepared-gitdir"},
127 want: "--git-dir is required with --prepared-gitdir",
128 },
129 {
130 name: "async_clone_requires_remote",
131 args: []string{"add-repo", "--name", "repo", "--async"},
132 want: "--remote is required",
133 },
134 {
135 name: "async_rejects_inline_credentials",
136 args: []string{"add-repo", "--name", "repo", "--async", "--remote", "https://token@example.com/org/repo.git"},
137 want: "async repositories must use ambient credentials",

Callers

nothing calls this directly

Calls 2

RunFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected