forked from AppliedTrust/sweet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cisco_test.go
43 lines (36 loc) · 977 Bytes
/
cisco_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
package sweet
import (
"os"
"strings"
"testing"
"time"
)
func TestCiscoGood(t *testing.T) {
d := new(DeviceConfig)
d.Config = make(map[string]string)
d.Method = "cisco"
d.Timeout = 10 * time.Second
if os.Getenv("SWEET_TEST_HOST") == "" {
t.Error("Test requries SWEET_TEST_HOST environment variable")
return
}
if os.Getenv("SWEET_TEST_USER") == "" {
t.Error("Test requries SWEET_TEST_USER environment variable")
return
}
if os.Getenv("SWEET_TEST_PASS") == "" {
t.Error("Test requries SWEET_TEST_PASS environment variable")
return
}
d.Hostname = os.Getenv("SWEET_TEST_HOST")
d.Config["user"] = os.Getenv("SWEET_TEST_USER")
d.Config["pass"] = os.Getenv("SWEET_TEST_PASS")
d.Target = d.Hostname
s := CollectCisco(*d)
if !strings.Contains(s["config"], "aaa authorization commands") {
t.Errorf("Config missing aaa line")
}
if !strings.Contains(s["config"], "ntp access-group peer") {
t.Errorf("Config missing ntp line close to end")
}
}