-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
executable file
·68 lines (59 loc) · 1.49 KB
/
tests.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from collections import OrderedDict
from db_wctf.tables import FoxTrack
import json
logging.basicConfig()
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.DEBUG)
from webfox import (
gen_mac_address,
get_foxes,
add_fox,
mod_fox,
delete_fox,
)
if __name__ == '__main__':
mod_mac = gen_mac_address()
good_add = {
FoxTrack.bssid.name: mod_mac,
FoxTrack.ssid.name: 'foobar',
}
bad_add = {
'blarg': 'i dont exist',
}
good_mod = {
'bssid': mod_mac,
'ssid': 'other_thing',
'passphrase': 'super_secret',
}
bad_mod1 = {
'bssid': '00:00:00:00:00:00',
'ssid': 'i dont exist',
}
bad_mod2 = {
'bssid': 'foo bar baz',
}
bad_mod3 = {
'bssid': 'foo bar baz',
}
delete = {
'bssid': mod_mac,
}
TEST_DICT = OrderedDict()
TEST_DICT['existing'] = get_foxes()
TEST_DICT['good_add'] = add_fox(good_add)
TEST_DICT['bad_add'] = add_fox(bad_add)
TEST_DICT['post_add_foxes'] = get_foxes()
TEST_DICT['good_mod'] = mod_fox(good_mod)
TEST_DICT['badmods'] = [
mod_fox(bad_mod1),
mod_fox(bad_mod2),
mod_fox(bad_mod3),
]
TEST_DICT['good_mod_foxes'] = get_foxes()
TEST_DICT['delete'] = delete_fox(delete)
for k, v in TEST_DICT.items():
print("{} {}".format('*' * 20, k))
print(json.dumps(v, indent=4, separators=(',', ' : ')))