Fix str/unicode inconsistencies (#7)

This commit is contained in:
f4lco
2020-04-23 13:07:44 +02:00
parent d2837df10b
commit 5d7eb5c4cb
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -33,9 +33,8 @@ def _prices(offer):
price = offer[api_role]
# When no price is set, this can be empty dict
if isinstance(price, (unicode, str)) and price.strip():
# Convert unicode to str for PyOpenMensa -> misses type check
result[role] = str(price)
if isinstance(price, str) and price.strip():
result[role] = price
return result
+2 -2
View File
@@ -17,7 +17,7 @@ from tests.stub_api import api_offline, api_online_one_shot
def test_health_check(client):
response = client.get('/health_check')
assert response.status_code == 200
assert response.data == 'OK'
assert response.data == b'OK'
def test_index(client):
@@ -36,7 +36,7 @@ def test_index(client):
def test_canteen_not_found(client, url):
response = client.get(url)
assert response.status_code == 404
assert "Canteen 'spam' not found" in response.data
assert b"Canteen 'spam' not found" in response.data
@pytest.mark.xfail(strict=True)