From 75a60b1f5c9181830ad61e7d167cf6350cf25b33 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 11 Aug 2025 20:02:36 -0700 Subject: [PATCH] Fix test --- cmd/repos/create_test.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cmd/repos/create_test.go b/cmd/repos/create_test.go index 4e4b307..416c9b0 100644 --- a/cmd/repos/create_test.go +++ b/cmd/repos/create_test.go @@ -56,26 +56,29 @@ func TestCreateRepoObjectFormat(t *testing.T) { }, } - loginAddCmd := &cli.Command{ + loginCmd := &cli.Command{ Name: "login", Commands: []*cli.Command{ &login.CmdLoginAdd, + &login.CmdLoginList, }, } giteaUserName := os.Getenv("GITEA_TEA_TEST_USERNAME") giteaUserPasword := os.Getenv("GITEA_TEA_TEST_PASSWORD") - args := []string{"login", "add", "--name", "test-login", "--url", giteaURL, "--user", giteaUserName, "--password", giteaUserPasword} - err := loginAddCmd.Run(context.Background(), args) + args := []string{"login", "add", "--name", "test", "--url", giteaURL, "--user", giteaUserName, "--password", giteaUserPasword} + err := loginCmd.Run(context.Background(), args) + assert.NoError(t, err) + + err = loginCmd.Run(context.Background(), []string{"login", "list"}) assert.NoError(t, err) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { reposCmd := &cli.Command{ - Name: "repos", - + Name: "repos", Commands: []*cli.Command{&CmdRepoCreate}, } - tt.args = append(tt.args, "--login", "test-login") + tt.args = append(tt.args, "--login", "test") args := append([]string{"repos", "create"}, tt.args...) err := reposCmd.Run(context.Background(), args)