Commit 9429da8f authored by Vincent Pelletier's avatar Vincent Pelletier

test: Unpack request's return value.

Makes test a bit more readable by naming what each value is.
parent 7d0f56c3
...@@ -1667,14 +1667,14 @@ class CaucaseTest(unittest.TestCase): ...@@ -1667,14 +1667,14 @@ class CaucaseTest(unittest.TestCase):
server_name, server_name,
server_https_port, server_https_port,
) )
root_hateoas_request = request({ status, _, header_dict, body = request({
'SCRIPT_NAME': '/base/path', 'SCRIPT_NAME': '/base/path',
'REQUEST_METHOD': 'GET', 'REQUEST_METHOD': 'GET',
}) })
self.maxDiff = None self.maxDiff = None
self.assertEqual(root_hateoas_request[0], 200) self.assertEqual(status, 200)
self.assertEqual(root_hateoas_request[2]['Content-Type'], 'application/hal+json') self.assertEqual(header_dict['Content-Type'], 'application/hal+json')
self.assertEqual(json.loads(root_hateoas_request[3]), { self.assertEqual(json.loads(body), {
u"_links": { u"_links": {
u"getCAUHAL": { u"getCAUHAL": {
u"href": HATEOAS_HTTP_PREFIX + u"/cau", u"href": HATEOAS_HTTP_PREFIX + u"/cau",
...@@ -1689,14 +1689,14 @@ class CaucaseTest(unittest.TestCase): ...@@ -1689,14 +1689,14 @@ class CaucaseTest(unittest.TestCase):
}, },
}, },
}) })
cau_hateoas_request = request({ status, _, header_dict, body = request({
'SCRIPT_NAME': '/base/path', 'SCRIPT_NAME': '/base/path',
'PATH_INFO': '/cau/', 'PATH_INFO': '/cau/',
'REQUEST_METHOD': 'GET', 'REQUEST_METHOD': 'GET',
}) })
self.assertEqual(cau_hateoas_request[0], 200) self.assertEqual(status, 200)
self.assertEqual(cau_hateoas_request[2]['Content-Type'], 'application/hal+json') self.assertEqual(header_dict['Content-Type'], 'application/hal+json')
self.assertEqual(json.loads(cau_hateoas_request[3]), { self.assertEqual(json.loads(body), {
u"_actions": { u"_actions": {
u"createCertificate": { u"createCertificate": {
u"href": HATEOAS_HTTPS_PREFIX + u"/cau/crt/{+crt_id}", u"href": HATEOAS_HTTPS_PREFIX + u"/cau/crt/{+crt_id}",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment