summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xeffiapi16
-rw-r--r--yarns/000.yarn4
2 files changed, 20 insertions, 0 deletions
diff --git a/effiapi b/effiapi
index bb1af9e..5575a37 100755
--- a/effiapi
+++ b/effiapi
@@ -99,6 +99,22 @@ class FakeHTTPAPI(HTTPAPI):
'FakeHTTPAPI.GET url=%r headers=%r body=%r',
url, headers, body)
+ if url.endswith('/status'):
+ return self._get_status()
+
+ if url.endswith('/res'):
+ return self._get_resource(headers)
+
+ logging.error('Cannot server url')
+ assert 0
+
+ def _get_status(self):
+ body = {
+ 'resources': len(self._memb),
+ }
+ return FakeResponse(200, {}, body=json.dumps(body))
+
+ def _get_resource(self, headers):
if headers is None:
logging.warning('FakeHTTPAPI.GET: no resource id in headers')
return FakeResponse(400, {}, 'Missing headers')
diff --git a/yarns/000.yarn b/yarns/000.yarn
index 57179bb..9225c70 100644
--- a/yarns/000.yarn
+++ b/yarns/000.yarn
@@ -48,6 +48,10 @@ member, to update and retrieve it, and to search memberships.
THEN HTTP status is 201
AND the member id is ID
+ WHEN admin requests GET /status
+ THEN HTTP status is 200
+ AND HTTP body matches { "resources": 1 }
+
WHEN admin requests GET /memb with header Muck-Id: ${ID}
THEN HTTP status is 200
AND HTTP body matches { "fullname": "James Bond" }