forked from csirtgadgets/csirtg-indicator-py-v1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_email.py
45 lines (32 loc) · 897 Bytes
/
test_email.py
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
from faker import Faker
from csirtg_indicator import Indicator
fake = Faker()
def _not(data):
for d in data:
d = Indicator(d)
assert d.itype != 'email'
def test_email_ip():
data = ['192.168.1.0/24', '192.168.1.1', '2001:1608:10:147::21', '2001:4860:4860::8888']
_not(data)
def test_email_fqdn():
data = [
'1.2.3.4.org',
'www41.xzmnt.com',
]
_not(data)
def test_email_ok():
data = [
'{in|fo}@sunandsky.co.uk',
'w*[email protected]',
]
for d in data:
d = Indicator(d)
assert d.itype is 'email'
i = Indicator('[email protected]')
assert i.indicator == '[email protected]'
def test_email_random():
for d in range(0, 100):
assert Indicator(indicator=fake.email()).itype == 'email'