diff --git a/.gitignore b/.gitignore index f82852adf4dc0b2a50b95ffd691b04be57513447..1e0408df55b4b6ae7f092ed1b343c68449d6a2cd 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ __pycache__/ *.egg-info/ .coverage .pytest_cache/ +.idea \ No newline at end of file diff --git a/tests/test_middleware.py b/tests/test_middleware.py index 37dbd174bdf600ddee2fbb0b17ae53813e69c4a9..d599f7413bc149b2c0ac283c2af7d252833e68ea 100644 --- a/tests/test_middleware.py +++ b/tests/test_middleware.py @@ -48,7 +48,8 @@ def test_wrong_header(snapshot): request.META.get.assert_called_once_with('HTTP_AUTHORIZATION') 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): @@ -61,7 +62,8 @@ def test_invalid_token(snapshot): request.META.get.assert_called_once_with('HTTP_AUTHORIZATION') 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):