From 641c1070bf650c0ee14af1e1288d6a849b3aa976 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 5 Nov 2017 15:03:41 +0100 Subject: Add: implement foo makes BAR request in user-agnostic way --- yarns/900-implements.yarn | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'yarns/900-implements.yarn') diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index 0803abe..8afc97a 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -21,9 +21,10 @@ along with this program. If not, see . ## HTTP requests of various kinds - IMPLEMENTS WHEN user makes request GET (\S+) + IMPLEMENTS WHEN (\S+) makes request GET (\S+) + user = get_next_match() path = get_next_match() - token = get_token('user') + token = get_token(user) url = vars['url'] status, content_type, headers, body = get(url + path, token) vars['status_code'] = status @@ -31,12 +32,13 @@ along with this program. If not, see . vars['headers'] = headers vars['body'] = body - IMPLEMENTS WHEN user makes request POST (\S+) (.+) + IMPLEMENTS WHEN (\S+) makes request POST (\S+) (.+) + user = get_next_match() path = get_next_match() body_text = get_next_match() print('path', path) print('body', body_text) - token = get_token('user') + token = get_token(user) url = vars['url'] status, content_type, headers, body = post(url + path, body_text, token) vars['status_code'] = status @@ -57,9 +59,10 @@ along with this program. If not, see . vars['headers'] = headers vars['body'] = body - IMPLEMENTS WHEN user makes request DELETE (\S+) + IMPLEMENTS WHEN (\S+) makes request DELETE (\S+) + user = get_next_match() path = get_next_match() - token = get_token('user') + token = get_token(user) url = vars['url'] status, content_type, headers, body = delete(url + path, token) vars['status_code'] = status @@ -67,12 +70,6 @@ along with this program. If not, see . vars['headers'] = headers vars['body'] = body - IMPLEMENTS WHEN worker-manager makes request POST (/\S+) (.+) - assert 0 - - IMPLEMENTS WHEN worker-manager makes request GET (/\S+) - assert 0 - ## HTTP response inspection IMPLEMENTS THEN result has status code (\d+) -- cgit v1.2.1