rickub/clipublic Fork
⑂ 93ced54
Commits
⬇ Clone ▾
git clone https://git.rickub.com/rickub/cli.git
git clone ssh://git@rickub.com/rickub/cli.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

tests: reset every command flag in execute(), not inside individual testsUnverified

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FgkcT3UPxwxukBKojB5eg4
Olivier Girardot committed 2026-09-06T17:35:05+02:00 Browse files
93ced54 parent: 8aaf8d0
modified cmd/release_smoke_test.go +0 -7
@@ -121,7 +121,6 @@ func TestPRCreateSendsDraftExplicitly(t *testing.T) {
121121 t.Errorf("unexpected output for a ready MR:\n%s", out)
122122 }
123123
124- prDraft = false
125124 out, _, err = execute(t, "pr", "create", "-R", "rick/portal", "--base", "main", "--head", "f", "--title", "T", "--draft")
126125 if err != nil {
127126 t.Fatalf("pr create --draft: %v", err)
@@ -132,9 +131,7 @@ func TestPRCreateSendsDraftExplicitly(t *testing.T) {
132131 if !strings.Contains(out, "draft merge request #2") || !strings.Contains(out, "pr ready 2") {
133132 t.Errorf("draft output should say so and point at pr ready:\n%s", out)
134133 }
135- prDraft = false
136134
137- prReadyUndo = false
138135 out, _, err = execute(t, "pr", "ready", "7", "-R", "rick/portal")
139136 if err != nil {
140137 t.Fatalf("pr ready: %v", err)
@@ -149,7 +146,6 @@ func TestPRCreateSendsDraftExplicitly(t *testing.T) {
149146 if !strings.Contains(out, "#7 is a draft again") {
150147 t.Errorf("pr ready --undo output:\n%s", out)
151148 }
152- prReadyUndo = false
153149 }
154150
155151 func TestPRListShowsDraft(t *testing.T) {
@@ -205,7 +201,6 @@ func TestLabelCommands(t *testing.T) {
205201 t.Setenv("RICKUB_HOST", srv.URL)
206202 t.Setenv("RICKUB_TOKEN", "rickub_pat_test")
207203
208- labelColor, labelNewName = "", ""
209204 out, _, err := execute(t, "label", "create", "docs", "-R", "rick/portal", "--color", "#0075ca")
210205 if err != nil {
211206 t.Fatalf("label create: %v", err)
@@ -217,7 +212,6 @@ func TestLabelCommands(t *testing.T) {
217212 t.Errorf("create output:\n%s", out)
218213 }
219214
220- labelColor, labelNewName = "", ""
221215 if _, _, err := execute(t, "label", "edit", "bug", "-R", "rick/portal", "--name", "defect", "--color", "ffffff"); err != nil {
222216 t.Fatalf("label edit (case-insensitive lookup): %v", err)
223217 }
@@ -225,7 +219,6 @@ func TestLabelCommands(t *testing.T) {
225219 t.Errorf("patch body = %v", patched)
226220 }
227221
228- labelColor, labelNewName = "", ""
229222 if _, _, err := execute(t, "label", "edit", "bug", "-R", "rick/portal"); err == nil {
230223 t.Error("edit with nothing to change should fail")
231224 }
@@ -121,7 +121,6 @@ func TestPRCreateSendsDraftExplicitly(t *testing.T) {
121 t.Errorf("unexpected output for a ready MR:\n%s", out)121 t.Errorf("unexpected output for a ready MR:\n%s", out)
122 }122 }
123 123
124- prDraft = false
125 out, _, err = execute(t, "pr", "create", "-R", "rick/portal", "--base", "main", "--head", "f", "--title", "T", "--draft")124 out, _, err = execute(t, "pr", "create", "-R", "rick/portal", "--base", "main", "--head", "f", "--title", "T", "--draft")
126 if err != nil {125 if err != nil {
127 t.Fatalf("pr create --draft: %v", err)126 t.Fatalf("pr create --draft: %v", err)
@@ -132,9 +131,7 @@ func TestPRCreateSendsDraftExplicitly(t *testing.T) {
132 if !strings.Contains(out, "draft merge request #2") || !strings.Contains(out, "pr ready 2") {131 if !strings.Contains(out, "draft merge request #2") || !strings.Contains(out, "pr ready 2") {
133 t.Errorf("draft output should say so and point at pr ready:\n%s", out)132 t.Errorf("draft output should say so and point at pr ready:\n%s", out)
134 }133 }
135- prDraft = false
136 134
137- prReadyUndo = false
138 out, _, err = execute(t, "pr", "ready", "7", "-R", "rick/portal")135 out, _, err = execute(t, "pr", "ready", "7", "-R", "rick/portal")
139 if err != nil {136 if err != nil {
140 t.Fatalf("pr ready: %v", err)137 t.Fatalf("pr ready: %v", err)
@@ -149,7 +146,6 @@ func TestPRCreateSendsDraftExplicitly(t *testing.T) {
149 if !strings.Contains(out, "#7 is a draft again") {146 if !strings.Contains(out, "#7 is a draft again") {
150 t.Errorf("pr ready --undo output:\n%s", out)147 t.Errorf("pr ready --undo output:\n%s", out)
151 }148 }
152- prReadyUndo = false
153 }149 }
154 150
155 func TestPRListShowsDraft(t *testing.T) {151 func TestPRListShowsDraft(t *testing.T) {
@@ -205,7 +201,6 @@ func TestLabelCommands(t *testing.T) {
205 t.Setenv("RICKUB_HOST", srv.URL)201 t.Setenv("RICKUB_HOST", srv.URL)
206 t.Setenv("RICKUB_TOKEN", "rickub_pat_test")202 t.Setenv("RICKUB_TOKEN", "rickub_pat_test")
207 203
208- labelColor, labelNewName = "", ""
209 out, _, err := execute(t, "label", "create", "docs", "-R", "rick/portal", "--color", "#0075ca")204 out, _, err := execute(t, "label", "create", "docs", "-R", "rick/portal", "--color", "#0075ca")
210 if err != nil {205 if err != nil {
211 t.Fatalf("label create: %v", err)206 t.Fatalf("label create: %v", err)
@@ -217,7 +212,6 @@ func TestLabelCommands(t *testing.T) {
217 t.Errorf("create output:\n%s", out)212 t.Errorf("create output:\n%s", out)
218 }213 }
219 214
220- labelColor, labelNewName = "", ""
221 if _, _, err := execute(t, "label", "edit", "bug", "-R", "rick/portal", "--name", "defect", "--color", "ffffff"); err != nil {215 if _, _, err := execute(t, "label", "edit", "bug", "-R", "rick/portal", "--name", "defect", "--color", "ffffff"); err != nil {
222 t.Fatalf("label edit (case-insensitive lookup): %v", err)216 t.Fatalf("label edit (case-insensitive lookup): %v", err)
223 }217 }
@@ -225,7 +219,6 @@ func TestLabelCommands(t *testing.T) {
225 t.Errorf("patch body = %v", patched)219 t.Errorf("patch body = %v", patched)
226 }220 }
227 221
228- labelColor, labelNewName = "", ""
229 if _, _, err := execute(t, "label", "edit", "bug", "-R", "rick/portal"); err == nil {222 if _, _, err := execute(t, "label", "edit", "bug", "-R", "rick/portal"); err == nil {
230 t.Error("edit with nothing to change should fail")223 t.Error("edit with nothing to change should fail")
231 }224 }
modified cmd/repo_test.go +5 -0
@@ -47,6 +47,11 @@ func execute(t *testing.T, args ...string) (string, string, error) {
4747 prCommit = ""
4848 prReplyTo = ""
4949 prReopen = false
50+ prDraft = false
51+ prReadyUndo = false
52+ labelRepo = ""
53+ labelColor = ""
54+ labelNewName = ""
5055
5156 var out, errBuf bytes.Buffer
5257 rootCmd.SetOut(&out)
@@ -47,6 +47,11 @@ func execute(t *testing.T, args ...string) (string, string, error) {
47 prCommit = ""47 prCommit = ""
48 prReplyTo = ""48 prReplyTo = ""
49 prReopen = false49 prReopen = false
50+ prDraft = false
51+ prReadyUndo = false
52+ labelRepo = ""
53+ labelColor = ""
54+ labelNewName = ""
50 55
51 var out, errBuf bytes.Buffer56 var out, errBuf bytes.Buffer
52 rootCmd.SetOut(&out)57 rootCmd.SetOut(&out)