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.
This commit is contained in:
Rebecca Law
2016-03-30 08:41:07 +01:00
parent a4629a290a
commit 017baca5e5
3 changed files with 5 additions and 4 deletions

View File

@@ -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'

View File

@@ -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,

View File

@@ -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')