mirror of
https://gitea.com/gitea/tea.git
synced 2026-05-15 20:29:22 +02:00
fix
This commit is contained in:
@@ -7,10 +7,25 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"code.gitea.io/tea/modules/config"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestReply(t *testing.T) {
|
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 {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
args []string
|
args []string
|
||||||
@@ -41,7 +56,7 @@ func TestReply(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
cmd := CmdPullsReply
|
cmd := CmdPullsReply
|
||||||
args := append([]string{"reply"}, tt.args...)
|
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)
|
err := cmd.Run(context.Background(), args)
|
||||||
if tt.wantErr {
|
if tt.wantErr {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user