-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_test.go
65 lines (62 loc) · 1.25 KB
/
deploy_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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"os"
"testing"
)
func Test_runCommand(t *testing.T) {
type args struct {
command string
args []string
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "echo",
args: args{
command: "echo",
args: []string{"hello"},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := runCommand(tt.args.command, tt.args.args...); (err != nil) != tt.wantErr {
t.Errorf("runCommand() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
func Test_getDeployments(t *testing.T) {
type args struct {
accountId string
email string
apiToken string
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: "get deployments",
args: args{
accountId: os.Getenv("ACCOUNT_ID"),
email: os.Getenv("EMAIL"),
apiToken: os.Getenv("API_TOKEN"),
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if url, err := getLatestDeployment(tt.args.accountId, tt.args.email, tt.args.apiToken); (err != nil) != tt.wantErr {
t.Errorf("getLatestDeployment() error = %v, wantErr %v", err, tt.wantErr)
t.Logf("recieved url: %s\n", url)
}
})
}
}