forked from Telmate/proxmox-api-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
standard.go
52 lines (44 loc) · 1.26 KB
/
standard.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
package storagesubtests
import (
"testing"
_ "github.com/Telmate/proxmox-api-go/cli/command/commands"
"github.com/Telmate/proxmox-api-go/proxmox"
cliTest "github.com/Telmate/proxmox-api-go/test/cli"
)
func Cleanup(name string, t *testing.T) {
Test := cliTest.Test{
ReqErr: true,
ErrContains: name,
Args: []string{"-i", "delete", "storage", name},
}
Test.StandardTest(t)
}
func Delete(name string, t *testing.T) {
Test := cliTest.Test{
Contains: []string{name},
Args: []string{"-i", "delete", "storage", name},
}
Test.StandardTest(t)
}
func Get(s *proxmox.ConfigStorage, name string, t *testing.T) {
cliTest.SetEnvironmentVariables()
Test := cliTest.Test{
OutputJson: InlineMarshal(s),
Args: []string{"-i", "get", "storage", name},
}
Test.StandardTest(t)
}
func Create(s *proxmox.ConfigStorage, name string, t *testing.T) {
createOrUpdate(s, name, "create", t)
}
func Update(s *proxmox.ConfigStorage, name string, t *testing.T) {
createOrUpdate(s, name, "update", t)
}
func createOrUpdate(s *proxmox.ConfigStorage, name, command string, t *testing.T) {
Test := cliTest.Test{
InputJson: InlineMarshal(s),
Contains: []string{"(" + name + ")"},
Args: []string{"-i", command, "storage", name},
}
Test.StandardTest(t)
}