summaryrefslogtreecommitdiff
path: root/yarns/000.yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/000.yarn')
-rw-r--r--yarns/000.yarn37
1 files changed, 29 insertions, 8 deletions
diff --git a/yarns/000.yarn b/yarns/000.yarn
index adff964..79e398d 100644
--- a/yarns/000.yarn
+++ b/yarns/000.yarn
@@ -33,17 +33,20 @@ Examples will be provided.
## Manage memberships
-This section shows the API calls to manage a memberhip: to create the
-member, to update and retrieve it, and to search memberships.
+This section shows the API calls to manage a memberhip.
SCENARIO Manage memberships
GIVEN An effiapi instance
+First make sure the register is empty.
+
WHEN admin requests GET /status
THEN HTTP status is 200
AND body matches { "resources": 0 }
+Create a member.
+
WHEN admin requests POST /memb with body { "fullname": "James Bond" }
THEN HTTP status is 201
AND remember header Muck-Id as ID
@@ -58,6 +61,8 @@ member, to update and retrieve it, and to search memberships.
AND body matches { "fullname": "James Bond" }
AND header Muck-Revision is ${REV1}
+Update the member.
+
WHEN admin requests PUT /memb with id ${ID}, revision ${REV1},
... and body { "fullname": "Alfred Pennyworth" }
THEN HTTP status is 200
@@ -68,12 +73,24 @@ member, to update and retrieve it, and to search memberships.
AND body matches { "fullname": "Alfred Pennyworth" }
AND header Muck-Revision is ${REV2}
+Delete the member.
+
+ WHEN admin requests DELETE /memb with id ${ID}
+ THEN HTTP status is 200
+
+ WHEN admin requests GET /status
+ THEN HTTP status is 200
+ AND body matches { "resources": 0 }
+
+ WHEN admin requests GET /memb with header Muck-Id: ${ID}
+ THEN HTTP status is 404
+
+Done.
+
FINALLY Effiapi is terminated
TODO:
-* update
-* delete
* search
* members can see their own data, and can't see each others'
* member follows authn link emailed to them
@@ -119,12 +136,16 @@ TODO:
headers = {
header: value,
}
- V['xx'] = {
- 'header': header,
- 'value': value,
- }
effiapi.GET('/memb', headers, None)
+ IMPLEMENTS WHEN admin requests DELETE /memb with id (\S+)
+ rid = get_expanded_match()
+ print('rid', repr(rid))
+ headers = {
+ 'Muck-id': rid,
+ }
+ effiapi.DELETE('/memb', headers, None)
+
## Inspect HTTP responses
IMPLEMENTS THEN HTTP status is (\d+)