summaryrefslogtreecommitdiff
path: root/yarns/900-implements.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-05 12:51:31 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-05 12:51:31 +0100
commit9eed0d65ba6ff39aa41a0bfbc3926605416b2dfe (patch)
tree71d57734550e470eafdbcd16ac09afdfcf3377cb /yarns/900-implements.yarn
parent7aec1bd1ead044af596ccbb926c7bed9c633737d (diff)
downloadick2-9eed0d65ba6ff39aa41a0bfbc3926605416b2dfe.tar.gz
Add: store, retrieve tokens using helpers
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r--yarns/900-implements.yarn21
1 files changed, 12 insertions, 9 deletions
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
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://www.gnu.org/licenses/>.
## HTTP response inspection
IMPLEMENTS THEN result has status code (\d+)
- print(cat('token.jwt'))
expected = int(get_next_match())
assertEqual(expected, vars['status_code'])