This commit is contained in:
Lunny Xiao
2025-08-10 18:32:11 -07:00
parent 37d7ee69da
commit 03c2dfdaec
2 changed files with 6 additions and 13 deletions

View File

@ -4,13 +4,14 @@
package repos
import (
"context"
"fmt"
"testing"
"time"
"code.gitea.io/sdk/gitea"
"github.com/stretchr/testify/assert"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v3"
)
func TestCreateRepoObjectFormat(t *testing.T) {
@ -50,16 +51,14 @@ func TestCreateRepoObjectFormat(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
app := cli.NewApp()
reposCmd := &cli.Command{
Name: "repos",
Aliases: []string{"repo"},
Subcommands: []*cli.Command{&CmdRepoCreate},
Name: "repos",
Aliases: []string{"repo"},
Commands: []*cli.Command{&CmdRepoCreate},
}
app.Commands = []*cli.Command{reposCmd}
args := append([]string{"tea", "repos", "create"}, tt.args...)
err := app.Run(args)
err := reposCmd.Run(context.Background(), args)
if tt.wantErr {
assert.Error(t, err)
if tt.errContains != "" {
@ -69,8 +68,6 @@ func TestCreateRepoObjectFormat(t *testing.T) {
}
assert.NoError(t, err)
// Note: We can't directly test the CreateRepoOption since it's created inside runRepoCreate
// In a real test environment, we would mock the client and verify the options passed to it
})
}
}