We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7575651 commit 580815cCopy full SHA for 580815c
2 files changed
abe/__init__.py
@@ -0,0 +1 @@
1
+__version__ = '0.1.0'
abe/mocks.py
@@ -0,0 +1,24 @@
+import json
2
+
3
+from supermutes.dot import dotify
4
5
6
+class AbeMock(object):
7
8
+ def __init__(self, filename):
9
+ """
10
+ Initialise an ABE mock from data.
11
12
+ filename is expected to be the path to an ABE file.
13
14
15
+ with open(filename, 'r') as f:
16
+ data = json.load(f)
17
18
+ # map JSON fields to attributes
19
+ self.__dict__ = data
20
21
+ # Make all example requests and reponses accessible via dot syntax
22
+ # (e.g. mock["OK"].request.status)
23
+ for k, v in self.examples.items():
24
+ self.examples[k] = dotify(v)
0 commit comments