From 9eed0d65ba6ff39aa41a0bfbc3926605416b2dfe Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 5 Nov 2017 12:51:31 +0100 Subject: Add: store, retrieve tokens using helpers --- yarns/900-implements.yarn | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'yarns/900-implements.yarn') diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index 49c68b2..0803abe 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -23,11 +23,12 @@ along with this program. If not, see . IMPLEMENTS WHEN user makes request GET (\S+) path = get_next_match() - token = cat('token.jwt') + token = get_token('user') url = vars['url'] - status, content_type, body = get(url + path, token) + status, content_type, headers, body = get(url + path, token) vars['status_code'] = status vars['content_type'] = content_type + vars['headers'] = headers vars['body'] = body IMPLEMENTS WHEN user makes request POST (\S+) (.+) @@ -35,11 +36,12 @@ along with this program. If not, see . body_text = get_next_match() print('path', path) print('body', body_text) - token = cat('token.jwt') + token = get_token('user') url = vars['url'] - status, content_type, body = post(url + path, body_text, token) + status, content_type, headers, body = post(url + path, body_text, token) vars['status_code'] = status vars['content_type'] = content_type + vars['headers'] = headers vars['body'] = body IMPLEMENTS WHEN user makes request PUT (\S+) (.+) @@ -47,20 +49,22 @@ along with this program. If not, see . body_text = get_next_match() print('path', path) print('body', body_text) - token = cat('token.jwt') + token = get_token('user') url = vars['url'] - status, content_type, body = put(url + path, body_text, token) + status, content_type, headers, body = put(url + path, body_text, token) vars['status_code'] = status vars['content_type'] = content_type + vars['headers'] = headers vars['body'] = body IMPLEMENTS WHEN user makes request DELETE (\S+) path = get_next_match() - token = cat('token.jwt') + token = get_token('user') url = vars['url'] - status, content_type, body = delete(url + path, token) + status, content_type, headers, body = delete(url + path, token) vars['status_code'] = status vars['content_type'] = content_type + vars['headers'] = headers vars['body'] = body IMPLEMENTS WHEN worker-manager makes request POST (/\S+) (.+) @@ -72,7 +76,6 @@ along with this program. If not, see . ## HTTP response inspection IMPLEMENTS THEN result has status code (\d+) - print(cat('token.jwt')) expected = int(get_next_match()) assertEqual(expected, vars['status_code']) -- cgit v1.2.1