def test_preferences_api_user_exists(app, database, fake_user): with app.test_request_context('/[email protected]'): response = preferences_api().json assert response == [{ 'id': database.sub.key.urlsafe(), 'title': 'Yelp Weekly', 'location': '8th Floor', 'office': 'USA: CA SF New Montgomery Office', 'timezone': 'America/Los_Angeles', 'size': 2, 'rule_logic': None, 'datetime': [{ 'active': True, 'date': '2017-01-20T23:00:00+00:00', 'id': database.sub.datetime[0].urlsafe() }, { 'active': False, 'date': '2017-01-20T19:00:00+00:00', 'id': database.sub.datetime[1].urlsafe() }], }]
def test_preferences_api_no_user(app, minimal_database): with app.test_request_context('/[email protected]'): response = preferences_api() assert response.json == []