From 04c80ff3559577ea48e71b14b39df350f937f24a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 15 Dec 2017 16:54:49 +0200 Subject: Refactor: rename body_text to body throughout --- yarns/900-implements.yarn | 16 ++++++++-------- yarns/lib.py | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'yarns') diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index 410191c..1a42198 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -53,26 +53,26 @@ along with this program. If not, see . IMPLEMENTS WHEN (\S+) makes request POST (\S+) with a valid token and body (.+) user = get_next_match() path = get_next_match() - body_text = get_next_match() + body = get_next_match() token = get_token(user) url = vars['url'] - http(vars, post, url + path, body_text=body_text, token=token) + http(vars, post, url + path, body=body, token=token) IMPLEMENTS WHEN (\S+) makes request POST (\S+) with an invalid token and body (.+) user = get_next_match() path = get_next_match() - body_text = get_next_match() + body = get_next_match() token = get_token(user) url = vars['url'] - http(vars, post, url + path, body_text=body_text, token='invalid') + http(vars, post, url + path, body=body, token='invalid') IMPLEMENTS WHEN (\S+) makes request PUT (\S+) with a valid token and body (.+) user = get_next_match() path = get_next_match() - body_text = get_next_match() + body = get_next_match() token = get_token(user) url = vars['url'] - http(vars, put, url + path, body_text=body_text, token=token) + http(vars, put, url + path, body=body, token=token) IMPLEMENTS WHEN (\S+) sends blob (\S+) to blob service as (\S+) user = get_next_match() @@ -86,10 +86,10 @@ along with this program. If not, see . IMPLEMENTS WHEN (\S+) makes request PUT (\S+) with an invalid token user = get_next_match() path = get_next_match() - body_text = '{}' + body = '{}' token = get_token(user) url = vars['url'] - http(vars, put, url + path, body_text=body_text, token='invalid') + http(vars, put, url + path, body=body, token='invalid') IMPLEMENTS WHEN (\S+) makes request DELETE (\S+) user = get_next_match() diff --git a/yarns/lib.py b/yarns/lib.py index 8f885c0..b19ccf3 100644 --- a/yarns/lib.py +++ b/yarns/lib.py @@ -120,21 +120,21 @@ def get_blob(url, token): return r.status_code, r.headers['Content-Type'], dict(r.headers), r.content -def post(url, body_text, token): +def post(url, body, token): headers = { 'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json', } - r = requests.post(url, headers=headers, data=body_text, verify=False) + r = requests.post(url, headers=headers, data=body, verify=False) return r.status_code, r.headers['Content-Type'], dict(r.headers), r.text -def put(url, body_text, token): +def put(url, body, token): headers = { 'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json', } - r = requests.put(url, headers=headers, data=body_text, verify=False) + r = requests.put(url, headers=headers, data=body, verify=False) return r.status_code, r.headers['Content-Type'], dict(r.headers), r.text -- cgit v1.2.1