-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli_ali_test.go
50 lines (43 loc) · 1 KB
/
cli_ali_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"github.com/stretchr/testify/assert"
"github.com/urfave/cli"
"os"
"testing"
)
func TestAliOssCli_Test(t *testing.T) {
app := makeApp()
c := &AliOssCli{}
registerFlags(app)
app.Commands = []cli.Command{
{Name: "test", Action: c.Test},
}
args := os.Args[0:1]
args = append(args, "test")
err := app.Run(args)
assert.Nil(t, err)
}
func TestAliOssCli_ListFiles(t *testing.T) {
app := makeApp()
c := &AliOssCli{}
registerFlags(app)
app.Commands = []cli.Command{
{Name: "list", Action: c.ListFiles, Flags: getListFlags()},
}
args := os.Args[0:1]
args = append(args, "list", "--prefix=", "--limit=0", "--dir")
err := app.Run(args)
assert.Nil(t, err)
}
func TestAliOssCli_Add(t *testing.T) {
app := makeApp()
c := &AliOssCli{}
registerFlags(app)
app.Commands = []cli.Command{
{Name: "add", Action: c.Add, Flags: getAddFlags()},
}
args := os.Args[0:1]
args = append(args, "add", "--file=~/Desktop", "--save=test/", "--random=32")
err := app.Run(args)
assert.Nil(t, err)
}