summaryrefslogtreecommitdiff
path: root/yarns
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-10-05 14:20:06 +0300
committerLars Wirzenius <liw@liw.fi>2017-10-05 18:02:43 +0300
commit2018a4435fb3adac67d9c3e2ef62a25fa5e90668 (patch)
treebcf353d4623659d988add13493fd9798908ae2c1 /yarns
parent20857d7daac579fec104ed11271c2fbec3990e09 (diff)
downloadqvisqve-2018a4435fb3adac67d9c3e2ef62a25fa5e90668.tar.gz
Add: implement get id of given item in search result
Diffstat (limited to 'yarns')
-rw-r--r--yarns/900-implements.yarn17
1 files changed, 16 insertions, 1 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index fdb3a56..2c79768 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -201,7 +201,22 @@ Start a Qvarn running in the background.
import json
index = get_next_match()
id_name = get_next_match()
- assert 0
+ body = json.loads(vars['body'])
+ print 'body', repr(body)
+ print 'resources', repr(body['resources'])
+ print 'at index', repr(body['resources'][index])
+ print 'id', repr(body['resources'][index]['id'])
+ vars[id_name] = body['resources'][index]['id']
+
+ found = False
+ for result in actual['resources']:
+ if values_match(wanted, result):
+ print 'MATCH!', repr(wanted), repr(result)
+ found = True
+ break
+ print 'no match', repr(wanted), repr(result)
+ assertTrue(found)
+
IMPLEMENTS THEN response has header WWW-Authenticate containing "(.+)"
assert 0