-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstep_test.go
76 lines (61 loc) · 1.36 KB
/
step_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
66
67
68
69
70
71
72
73
74
75
76
package main
import (
"fmt"
"testing"
)
var (
TestHost = "192.168.1.1"
TestUsername = ""
TestPassword = ""
)
func TestGetRandCount(t *testing.T) {
rc, err := GetRandCount(getRandCountUrl(TestHost))
if err != nil {
panic(err)
}
fmt.Println(rc)
}
func TestLoginAndGetCookie(t *testing.T) {
rc, err := GetRandCount(getRandCountUrl(TestHost))
if err != nil {
panic(err)
}
c, err := LoginAndGetCookie(getLoginUrl(TestHost), TestUsername, TestPassword, rc)
if err != nil {
panic(err)
}
fmt.Println(c.Raw)
}
func TestGetDevicePageRandCount(t *testing.T) {
rc, err := GetRandCount(getRandCountUrl(TestHost))
if err != nil {
panic(err)
}
c, err := LoginAndGetCookie(getLoginUrl(TestHost), TestUsername, TestPassword, rc)
if err != nil {
panic(err)
}
dpRc, err := GetDevicePageRandCount(getDevicePageUrl(TestHost), c)
if err != nil {
panic(err)
}
fmt.Println(dpRc)
}
func TestPatch(t *testing.T) {
initRandCount, err := GetRandCount(getRandCountUrl(TestHost))
if err != nil {
panic(err)
}
cookie, err := LoginAndGetCookie(getLoginUrl(TestHost), TestUsername, TestPassword, initRandCount)
if err != nil {
panic(err)
}
patchRandCount, err := GetDevicePageRandCount(getDevicePageUrl(TestHost), cookie)
if err != nil {
panic(err)
}
err = Patch(getPatchPageUrl(TestHost), patchRandCount, cookie)
if err != nil {
panic(err)
}
}