forked from vz-risk/veris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify_keys.py
33 lines (27 loc) · 936 Bytes
/
verify_keys.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
import json
import requests
from datadiff.tools import assert_equal
def getKeyName(obj):
if type(obj) is dict:
return 'dict'
elif type(obj) is list:
return 'list'
elif type(obj) is str:
return obj
else:
return str(obj)
def norm(incoming):
if type(incoming) is dict:
return {key: norm(value) for key, value in sorted(incoming.iteritems())}
elif type(incoming) is list:
return {getKeyName(key): norm(key) for key in sorted(incoming)}
else:
return ''
def main():
r = requests.get("https://raw.githubusercontent.com/vz-risk/veris/master/verisc-labels.json")
labels = json.loads(r.text or r.content)
r = requests.get("https://raw.githubusercontent.com/vz-risk/veris/master/verisc-enum.json")
enum = json.loads(r.text or r.content)
assert_equal(norm(enum),norm(labels),msg='Differences Found')
if __name__ == '__main__':
main()