From a4ed6a39238de57b01678f40c87863d20102aa77 Mon Sep 17 00:00:00 2001 From: Sean Parsons Date: Sun, 25 Dec 2016 18:35:29 -0500 Subject: [PATCH] Added 2 more asserts to test_post_token for Bearer & Basic. --- tests/test_requests.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/test_requests.py b/tests/test_requests.py index 4e1fd1a5..b5897fbb 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -134,6 +134,32 @@ def test_post_token(): assert request.token == token assert response.text == 'OK' + # uuid4 generated token. + token = 'a1d895e0-553a-421a-8e22' + + headers = { + 'content-type': 'application/json', + 'Authorization': 'Bearer {}'.format(token) + } + + request, response = sanic_endpoint_test(app, data=json_dumps(payload), headers=headers) + + assert request.token == token + assert response.text == 'OK' + + # uuid4 generated token. + token = '421a-8e22-5ff8ecb48cbf' + + headers = { + 'content-type': 'application/json', + 'Authorization': 'Basic {}'.format(token) + } + + request, response = sanic_endpoint_test(app, data=json_dumps(payload), headers=headers) + + assert request.token == token + assert response.text == 'OK' + def test_post_form_urlencoded(): app = Sanic('test_post_form_urlencoded')