-
Notifications
You must be signed in to change notification settings - Fork 0
/
host_test.go
54 lines (41 loc) · 1023 Bytes
/
host_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
package sophosutm_test
import (
"github.com/DanielRis/sophosutm"
"testing"
)
var (
host sophosutm.Host
)
func TestCreateHost(t *testing.T) {
client, err := sophosutm.NewClient(ServerURL, APIUser, APIKey)
if err != nil {
t.Fatalf("err: %v", err)
}
host.Address = "192.168.200.1"
host, err := client.CreateHost(host)
if err != nil {
t.Fatalf("err: %v", err)
}
t.Logf("Host Ref: %s", host.Ref)
t.Logf("Host Name: %s", host.Name)
t.Logf("Host Comment: %s", host.Comment)
t.Logf("Host Address: %s", host.Address)
}
func TestGetHost(t *testing.T) {
client, err := sophosutm.NewClient(ServerURL, APIUser, APIKey)
if err != nil {
t.Fatalf("err: %v", err)
}
host, err := client.GetHost("REF_NetworkLocalhost")
if err != nil {
t.Fatalf("err: %v", err)
}
t.Logf("Host Name: %s", host.Name)
}
func TestDeleteHost(t *testing.T) {
client, err := sophosutm.NewClient(ServerURL, APIUser, APIKey)
if err != nil {
t.Fatalf("err: %v", err)
}
err = client.DeleteHost("REF_NetNetSophoGoClien")
}