-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenerator_test.go
More file actions
78 lines (71 loc) · 2.51 KB
/
Copy pathgenerator_test.go
File metadata and controls
78 lines (71 loc) · 2.51 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package har
import "testing"
func TestGeneratorHarNilReceiverMethods(t *testing.T) {
var h *Har
if got := h.SetBrowser("browser", "1.0"); got != nil {
t.Fatalf("SetBrowser() = %#v, want nil", got)
}
if got := h.SetVersion("1.2"); got != nil {
t.Fatalf("SetVersion() = %#v, want nil", got)
}
if got := h.SetCreator("creator", "1.0"); got != nil {
t.Fatalf("SetCreator() = %#v, want nil", got)
}
if got := h.AddPage("page", "Page"); got != nil {
t.Fatalf("AddPage() = %#v, want nil", got)
}
if got := h.AddEntry("GET", "https://example.com", "HTTP/1.1", ""); got != nil {
t.Fatalf("AddEntry() = %#v, want nil", got)
}
}
func TestGeneratorPageNilReceiverMethods(t *testing.T) {
var page *Pages
if got := page.SetPageTimings(10, 20); got != nil {
t.Fatalf("SetPageTimings() = %#v, want nil", got)
}
}
func TestGeneratorEntryNilReceiverMethods(t *testing.T) {
var entry *Entries
if got := entry.AddRequestHeader("A", "B"); got != nil {
t.Fatalf("AddRequestHeader() = %#v, want nil", got)
}
if got := entry.AddResponseHeader("A", "B"); got != nil {
t.Fatalf("AddResponseHeader() = %#v, want nil", got)
}
if got := entry.SetResponseStatus(200, "OK"); got != nil {
t.Fatalf("SetResponseStatus() = %#v, want nil", got)
}
if got := entry.SetResponseContent(10, "text/plain"); got != nil {
t.Fatalf("SetResponseContent() = %#v, want nil", got)
}
if got := entry.SetTimings(0, 0, 0, 0, 0, 0, 0); got != nil {
t.Fatalf("SetTimings() = %#v, want nil", got)
}
if got := entry.AddCookie("a", "b"); got != nil {
t.Fatalf("AddCookie() = %#v, want nil", got)
}
if got := entry.AddResponseCookie("a", "b"); got != nil {
t.Fatalf("AddResponseCookie() = %#v, want nil", got)
}
if got := entry.AddQueryParameter("a", "b"); got != nil {
t.Fatalf("AddQueryParameter() = %#v, want nil", got)
}
if got := entry.SetPostData("text/plain", "body"); got != nil {
t.Fatalf("SetPostData() = %#v, want nil", got)
}
if got := entry.SetPostDataParams("application/x-www-form-urlencoded", []Param{{Name: "a", Value: "b"}}); got != nil {
t.Fatalf("SetPostDataParams() = %#v, want nil", got)
}
if got := entry.SetResponseContentText("body"); got != nil {
t.Fatalf("SetResponseContentText() = %#v, want nil", got)
}
if got := entry.SetServerIP("127.0.0.1"); got != nil {
t.Fatalf("SetServerIP() = %#v, want nil", got)
}
if got := entry.SetConnection("conn"); got != nil {
t.Fatalf("SetConnection() = %#v, want nil", got)
}
if got := entry.SetPageref("page"); got != nil {
t.Fatalf("SetPageref() = %#v, want nil", got)
}
}