This commit is contained in:
Lunny Xiao
2025-08-11 20:02:36 -07:00
parent ef01274338
commit 75a60b1f5c

View File

@ -56,26 +56,29 @@ func TestCreateRepoObjectFormat(t *testing.T) {
}, },
} }
loginAddCmd := &cli.Command{ loginCmd := &cli.Command{
Name: "login", Name: "login",
Commands: []*cli.Command{ Commands: []*cli.Command{
&login.CmdLoginAdd, &login.CmdLoginAdd,
&login.CmdLoginList,
}, },
} }
giteaUserName := os.Getenv("GITEA_TEA_TEST_USERNAME") giteaUserName := os.Getenv("GITEA_TEA_TEST_USERNAME")
giteaUserPasword := os.Getenv("GITEA_TEA_TEST_PASSWORD") giteaUserPasword := os.Getenv("GITEA_TEA_TEST_PASSWORD")
args := []string{"login", "add", "--name", "test-login", "--url", giteaURL, "--user", giteaUserName, "--password", giteaUserPasword} args := []string{"login", "add", "--name", "test", "--url", giteaURL, "--user", giteaUserName, "--password", giteaUserPasword}
err := loginAddCmd.Run(context.Background(), args) err := loginCmd.Run(context.Background(), args)
assert.NoError(t, err)
err = loginCmd.Run(context.Background(), []string{"login", "list"})
assert.NoError(t, err) assert.NoError(t, err)
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
reposCmd := &cli.Command{ reposCmd := &cli.Command{
Name: "repos", Name: "repos",
Commands: []*cli.Command{&CmdRepoCreate}, 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...) args := append([]string{"repos", "create"}, tt.args...)
err := reposCmd.Run(context.Background(), args) err := reposCmd.Run(context.Background(), args)