summaryrefslogtreecommitdiff
path: root/yarns/900-implements.yarn
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-05 15:03:41 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-05 15:03:41 +0100
commit641c1070bf650c0ee14af1e1288d6a849b3aa976 (patch)
tree49c90f4d8d3ad762686a11d5a02b3a455d8b543a /yarns/900-implements.yarn
parentfc09ff30ca571fa55ca6096d4a420781e29d60b5 (diff)
downloadick2-641c1070bf650c0ee14af1e1288d6a849b3aa976.tar.gz
Add: implement foo makes BAR request in user-agnostic way
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r--yarns/900-implements.yarn21
1 files changed, 9 insertions, 12 deletions
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://www.gnu.org/licenses/>.
## 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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
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+)