From a1bc79d1ad8e4995a7d3ecec9c959d58770a7951 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 17 Jul 2018 13:27:10 +0300 Subject: Change: implement IMPLEMENTS for end-user-auth scenario --- yarns/900-implements.yarn | 56 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn index e21d8d5..7eea6d8 100644 --- a/yarns/900-implements.yarn +++ b/yarns/900-implements.yarn @@ -83,22 +83,23 @@ This chapter shows the scenario step implementations. V['API_URL'] + path, headers=headers) IMPLEMENTS WHEN browser requests GET (\S+) - # FIXME: This is a dummy implemantation, does not do anything real. path = get_next_match() V['status_code'], V['headers'], V['body'] = get(V['API_URL'] + path, {}) - IMPLEMENTS WHEN browser requests POST (\S+)$ - # FIXME: This is a dummy implemantation, does not do anything real. - pass - - IMPLEMENTS WHEN browser requests POST (\S+), with form values (\S+)=(\S+) and (\S+)=(\S+) - # FIXME: This is a dummy implemantation, does not do anything real. - V['status_code'] = 302 - - IMPLEMENTS WHEN facade requests POST (\S+), with form values (\S+)=(\S+) and (\S+)=(\S+) - # FIXME: This is a dummy implemantation, does not do anything real. - V['status_code'] = 200 - V['headers'] = {'Content-Type': 'application/json'} + IMPLEMENTS WHEN (browser|facade) requests POST (\S+), with form values (\S+)=(\S+) and (\S+)=(\S+) + who = get_next_match() + path = get_next_match() + field1 = get_next_match() + value1 = get_next_match() + field2 = get_next_match() + value2 = get_next_match() + headers = {} + body = { + field1: value1, + field2: value2, + } + V['status_code'], V['headers'], V['body'] = post( + V['API_URL'] + path, headers=headers, body=body) ## API access token creation @@ -172,23 +173,21 @@ This chapter shows the scenario step implementations. assertTrue(values_match(wanted, body)) IMPLEMENTS THEN body has an HTML form with field (.+) - # FIXME: This is a dummy implemantation, does not do anything real. - pass + field = get_next_match() + body = V['body'] + pattern = '