Skip to content
This repository has been archived by the owner on Mar 28, 2021. It is now read-only.

Commit

Permalink
Safer test
Browse files Browse the repository at this point in the history
  • Loading branch information
avalente committed Nov 1, 2014
1 parent 7fce58a commit 173485a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions appmetrics/tests/test_wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 173485a

Please sign in to comment.