-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_test.go
More file actions
53 lines (48 loc) · 1.32 KB
/
Copy pathsystem_test.go
File metadata and controls
53 lines (48 loc) · 1.32 KB
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
package fortimgr
import (
"context"
"testing"
)
func TestSystemStatus(t *testing.T) {
t.Run("not logged in", func(t *testing.T) {
c, _ := NewClient("https://example.com", WithCredentials("u", "p"))
_, err := c.SystemStatus(context.Background())
if err != ErrNotLoggedIn {
t.Errorf("err = %v, want ErrNotLoggedIn", err)
}
})
t.Run("success", func(t *testing.T) {
client := newTestClientWithProxy(t, nil, map[string]string{
"/gui/sys/config": `{
"hostname": "fmg-lab",
"sn": "FMG-VM0000000001",
"fmgversion": "v7.2.0-build1000 230101 (GA)",
"build_number": 1000,
"ha_mode": 0,
"platform-id": "FortiManager-VM64"
}`,
})
status, err := client.SystemStatus(context.Background())
if err != nil {
t.Fatal(err)
}
if status.Hostname != "fmg-lab" {
t.Errorf("Hostname = %q", status.Hostname)
}
if status.SerialNumber != "FMG-VM0000000001" {
t.Errorf("SerialNumber = %q", status.SerialNumber)
}
if status.Version != "v7.2.0-build1000 230101 (GA)" {
t.Errorf("Version = %q", status.Version)
}
if status.Platform != "FortiManager-VM64" {
t.Errorf("Platform = %q", status.Platform)
}
if status.Build != 1000 {
t.Errorf("Build = %d, want 1000", status.Build)
}
if status.HAMode != "standalone" {
t.Errorf("HAMode = %q, want \"standalone\"", status.HAMode)
}
})
}