separate detailed and normal service_api_client.get_service

to make it easier to mock and control return values
This commit is contained in:
Leo Hemsted
2016-07-20 11:46:29 +01:00
parent 3e6eedd079
commit 3ffd6c744c
8 changed files with 45 additions and 25 deletions

View File

@@ -6,14 +6,14 @@ from tests import validate_route_permission
def test_should_show_empty_api_keys_page(app_,
api_user_active,
api_user_pending,
mock_login,
mock_get_no_api_keys,
mock_get_service,
mock_has_permissions):
with app_.test_request_context():
with app_.test_client() as client:
client.login(api_user_active)
client.login(api_user_pending)
service_id = str(uuid.uuid4())
response = client.get(url_for('main.api_keys', service_id=service_id))

View File

@@ -421,8 +421,13 @@ def test_service_dashboard_updates_gets_dashboard_totals(mocker,
app_,
active_user_with_permissions,
service_one,
mock_get_user,
mock_get_service_templates,
mock_get_template_statistics,
mock_get_jobs,
mock_get_service_statistics,
mock_get_usage):
mock_get_usage,
mock_get_detailed_service):
dashboard_totals = mocker.patch('app.main.views.dashboard.get_dashboard_totals', return_value={
'email': {'requested': 0, 'delivered': 0, 'failed': 0},
'sms': {'requested': 0, 'delivered': 0, 'failed': 0}