From 017baca5e528251c5adb5d9f4d541ac0e3e7c319 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 30 Mar 2016 08:41:07 +0100 Subject: [PATCH] Add proper mocks for the test. Updated the localhost in the environment_test file so that if the tests fail if a mock is missing. --- environment_test.sh | 2 +- tests/app/main/views/test_templates.py | 3 ++- tests/conftest.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/environment_test.sh b/environment_test.sh index 9baca39f1..57f89ae58 100644 --- a/environment_test.sh +++ b/environment_test.sh @@ -1,6 +1,6 @@ export NOTIFY_ADMIN_ENVIRONMENT='config.Test' export ADMIN_CLIENT_SECRET='dev-notify-secret-key' export ADMIN_CLIENT_USER_NAME='dev-notify-admin' -export API_HOST_NAME='http://localhost:6011' +export API_HOST_NAME='http://localhost:6311' export DANGEROUS_SALT='dev-notify-salt' export SECRET_KEY='dev-notify-secret-key' diff --git a/tests/app/main/views/test_templates.py b/tests/app/main/views/test_templates.py index 2ece66d2a..bd57906e6 100644 --- a/tests/app/main/views/test_templates.py +++ b/tests/app/main/views/test_templates.py @@ -158,7 +158,8 @@ def test_route_permissions_for_choose_template(mocker, app_, api_user_active, service_one, - mock_get_service_template): + mock_get_service_templates): + mocker.patch('app.job_api_client.get_job') with app_.test_request_context(): validate_route_permission( mocker, diff --git a/tests/conftest.py b/tests/conftest.py index 95391c390..f2a548bea 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -158,13 +158,13 @@ def mock_get_service_statistics(mocker): @pytest.fixture(scope='function') def mock_get_service_template(mocker): - def _create(service_id, template_id): + def _get(service_id, template_id): template = template_json( service_id, template_id, "Two week reminder", "sms", "Your vehicle tax is about to expire") return {'data': template} return mocker.patch( - 'app.service_api_client.get_service_template', side_effect=_create) + 'app.service_api_client.get_service_template', side_effect=_get) @pytest.fixture(scope='function')