-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathcreate_tests.py
More file actions
executable file
·39 lines (29 loc) · 1017 Bytes
/
create_tests.py
File metadata and controls
executable file
·39 lines (29 loc) · 1017 Bytes
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
#!/usr/bin/env python3
import os
_dirname = os.path.dirname(os.path.abspath(__file__))
PATTERN = """
def test_{name}():
_filename = os.path.join(_dirname, "ekyc_examples/{typ}",
"{file_name}")
with open(_filename, "r") as fp:
_info = json.loads(fp.read())
vc = VerifiedClaims(**_info)
assert vc
"""
def create(typ):
doc = [
"import json",
"import os",
"from idpyoidc.message.oidc.identity_assurance import VerifiedClaims",
"_dirname = os.path.dirname(os.path.abspath(__file__))",
]
_root = os.path.join(_dirname, "ekyc_examples", typ)
for _file in os.listdir(_root):
_full_name = os.path.join(_root, _file)
if os.path.isfile(_full_name):
if _file.endswith(".json"):
name = _file[:-5]
doc.append(PATTERN.format(typ=typ, file_name=_file, name=name))
print("\n\n".join(doc))
if __name__ == "__main__":
create("response")