Skip to content
Snippets Groups Projects
Commit 2d5d5265 authored by Michal Holub's avatar Michal Holub
Browse files

response.content no longer breaks if bytes is returned

parent ebb4afc1
Branches
No related tags found
No related merge requests found
...@@ -5,3 +5,4 @@ __pycache__/ ...@@ -5,3 +5,4 @@ __pycache__/
*.egg-info/ *.egg-info/
.coverage .coverage
.pytest_cache/ .pytest_cache/
.idea
\ No newline at end of file
...@@ -48,7 +48,8 @@ def test_wrong_header(snapshot): ...@@ -48,7 +48,8 @@ def test_wrong_header(snapshot):
request.META.get.assert_called_once_with('HTTP_AUTHORIZATION') request.META.get.assert_called_once_with('HTTP_AUTHORIZATION')
assert response.status_code == 400 assert response.status_code == 400
snapshot.assert_match(json.loads(response.content)) as_str = response.content.decode() if hasattr(response.content, 'decode') else response.content
snapshot.assert_match(json.loads(as_str))
def test_invalid_token(snapshot): def test_invalid_token(snapshot):
...@@ -61,7 +62,8 @@ def test_invalid_token(snapshot): ...@@ -61,7 +62,8 @@ def test_invalid_token(snapshot):
request.META.get.assert_called_once_with('HTTP_AUTHORIZATION') request.META.get.assert_called_once_with('HTTP_AUTHORIZATION')
assert response.status_code == 401 assert response.status_code == 401
snapshot.assert_match(json.loads(response.content)) as_str = response.content.decode() if hasattr(response.content,'decode') else response.content
snapshot.assert_match(json.loads(as_str))
def test_unknown_user(snapshot): def test_unknown_user(snapshot):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment