From 173485a48a32c3736e63535bc0f81f79c87201a9 Mon Sep 17 00:00:00 2001 From: Antonio Valente Date: Sat, 1 Nov 2014 19:59:18 +0100 Subject: [PATCH] Safer test --- appmetrics/tests/test_wsgi.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appmetrics/tests/test_wsgi.py b/appmetrics/tests/test_wsgi.py index 02aae27..cc1c38d 100644 --- a/appmetrics/tests/test_wsgi.py +++ b/appmetrics/tests/test_wsgi.py @@ -158,17 +158,17 @@ def test_call_with_invalid_method(self): expected_body = json.dumps(werkzeug.exceptions.MethodNotAllowed.description) assert_equal(b"".join(body), expected_body.encode('utf8')) - expected_headers = [ - ('Content-Type', 'application/json'), - ('Allow', 'HEAD, GET'), - ('Content-Length', str(len(expected_body))) - ] assert_equal( self.start_response.call_args_list, [mock.call("405 METHOD NOT ALLOWED", mock.ANY)] ) - assert_equal(set(self.start_response.call_args_list[0][0][1]), set(expected_headers)) + headers = dict(self.start_response.call_args_list[0][0][1]) + assert_equal(headers['Content-Type'], "application/json") + assert_equal(headers['Content-Length'], str(len(expected_body))) + allow = {x.strip() for x in headers['Allow'].split(",")} + assert_equal(allow, {"HEAD", "GET"}) + def test_call_ok(self): self.handler.return_value = json.dumps("results")