forked from jaswdr/faker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
internet_test.go
134 lines (94 loc) · 2.19 KB
/
internet_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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package faker
import (
"strings"
"testing"
)
func TestUser(t *testing.T) {
i := New().Internet()
user := i.User()
Expect(t, true, len(user) > 0)
Expect(t, false, strings.Contains(user, " "))
}
func TestDomain(t *testing.T) {
i := New().Internet()
domain := i.Domain()
Expect(t, true, len(domain) > 0)
Expect(t, true, strings.Index(domain, ".") > 0)
split := strings.Split(domain, ".")
Expect(t, 2, len(split))
}
func TestEmail(t *testing.T) {
i := New().Internet()
email := i.Email()
split := strings.Split(email, "@")
Expect(t, 2, len(split))
}
func TestFreeEmail(t *testing.T) {
i := New().Internet()
email := i.FreeEmail()
split := strings.Split(email, "@")
Expect(t, 2, len(split))
}
func TestSafeEmail(t *testing.T) {
i := New().Internet()
email := i.SafeEmail()
split := strings.Split(email, "@")
Expect(t, 2, len(split))
}
func TestCompanyEmail(t *testing.T) {
i := New().Internet()
email := i.CompanyEmail()
split := strings.Split(email, "@")
Expect(t, 2, len(split))
}
func TestPassword(t *testing.T) {
i := New().Internet()
Expect(t, true, len(i.Password()) >= 6)
}
func TestTLD(t *testing.T) {
i := New().Internet()
Expect(t, true, len(i.TLD()) > 0)
}
func TestSlug(t *testing.T) {
i := New().Internet()
Expect(t, true, len(i.Slug()) > 0)
}
func TestURL(t *testing.T) {
i := New().Internet()
Expect(t, true, len(i.URL()) > 0)
}
func TestIpv4(t *testing.T) {
i := New().Internet()
ip := i.Ipv4()
Expect(t, true, len(ip) > 0)
split := strings.Split(ip, ".")
Expect(t, 4, len(split))
}
func TestLocalIpv4(t *testing.T) {
i := New().Internet()
ip := i.LocalIpv4()
Expect(t, true, len(ip) > 0)
split := strings.Split(ip, ".")
Expect(t, 4, len(split))
}
func TestIpv6(t *testing.T) {
i := New().Internet()
ip := i.Ipv6()
Expect(t, true, len(ip) > 0)
Expect(t, 39, len(ip))
split := strings.Split(ip, ":")
Expect(t, 8, len(split))
}
func TestMacAddress(t *testing.T) {
i := New().Internet()
Expect(t, 17, len(i.MacAddress()))
}
func TestHTTPMethod(t *testing.T) {
i := New().Internet()
Expect(t, true, len(i.HTTPMethod()) > 0)
}
func TestQuery(t *testing.T) {
i := New().Internet()
query := i.Query()
Expect(t, 0, strings.Index(query, "?"))
}