diff --git a/cmd/pulls/reply_test.go b/cmd/pulls/reply_test.go index 2e8ccb2..ac34815 100644 --- a/cmd/pulls/reply_test.go +++ b/cmd/pulls/reply_test.go @@ -7,10 +7,25 @@ import ( "context" "testing" + "code.gitea.io/tea/modules/config" + "github.com/stretchr/testify/assert" ) func TestReply(t *testing.T) { + config.SetConfigForTesting(config.LocalConfig{ + Logins: []config.Login{{ + Name: "testLogin", + URL: "https://gitea.example.com", + Token: "test-token", + User: "testUser", + Default: true, + }}, + }) + t.Cleanup(func() { + config.SetConfigForTesting(config.LocalConfig{}) + }) + tests := []struct { name string args []string @@ -41,7 +56,7 @@ func TestReply(t *testing.T) { t.Run(tt.name, func(t *testing.T) { cmd := CmdPullsReply args := append([]string{"reply"}, tt.args...) - args = append(args, "--repo", "user/repo") + args = append(args, "--login", "testLogin", "--repo", "user/repo") err := cmd.Run(context.Background(), args) if tt.wantErr { assert.Error(t, err)