Fix str/unicode inconsistencies (#7)
This commit is contained in:
+2
-3
@@ -33,9 +33,8 @@ def _prices(offer):
|
|||||||
|
|
||||||
price = offer[api_role]
|
price = offer[api_role]
|
||||||
# When no price is set, this can be empty dict
|
# When no price is set, this can be empty dict
|
||||||
if isinstance(price, (unicode, str)) and price.strip():
|
if isinstance(price, str) and price.strip():
|
||||||
# Convert unicode to str for PyOpenMensa -> misses type check
|
result[role] = price
|
||||||
result[role] = str(price)
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -17,7 +17,7 @@ from tests.stub_api import api_offline, api_online_one_shot
|
|||||||
def test_health_check(client):
|
def test_health_check(client):
|
||||||
response = client.get('/health_check')
|
response = client.get('/health_check')
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.data == 'OK'
|
assert response.data == b'OK'
|
||||||
|
|
||||||
|
|
||||||
def test_index(client):
|
def test_index(client):
|
||||||
@@ -36,7 +36,7 @@ def test_index(client):
|
|||||||
def test_canteen_not_found(client, url):
|
def test_canteen_not_found(client, url):
|
||||||
response = client.get(url)
|
response = client.get(url)
|
||||||
assert response.status_code == 404
|
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)
|
@pytest.mark.xfail(strict=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user