Merge pull request #271 from alphagov/remove-dao-layer

Start to remove the dao layer
This commit is contained in:
NIcholas Staples
2016-03-14 09:42:22 +00:00
5 changed files with 13 additions and 20 deletions

View File

@@ -7,7 +7,6 @@ def test_get_should_render_add_service_template(app_,
mock_login,
mock_get_service,
mock_get_services,
mock_get_user,
mock_get_user_by_email):
with app_.test_request_context():
with app_.test_client() as client:
@@ -21,9 +20,7 @@ def test_should_add_service_and_redirect_to_next_page(app_,
mock_login,
mock_create_service,
mock_get_services,
api_user_active,
mock_get_user,
mock_get_user_by_email):
api_user_active):
with app_.test_request_context():
with app_.test_client() as client:
client.login(api_user_active)
@@ -32,7 +29,9 @@ def test_should_add_service_and_redirect_to_next_page(app_,
data={'name': 'testing the post'})
assert response.status_code == 302
assert response.location == url_for('main.service_dashboard', service_id=101, _external=True)
assert mock_create_service.called
mock_create_service.asset_called_once_with('testing the post', False,
app_.config['DEFAULT_SERVICE_LIMIT'],
True, api_user_active.id)
def test_should_return_form_errors_when_service_name_is_empty(app_,

View File

@@ -70,7 +70,7 @@ def mock_create_service(mocker):
service = service_json(
101, service_name, [user_id], limit=limit,
active=active, restricted=restricted)
return {'data': service}
return service['id']
return mocker.patch(
'app.notifications_api_client.create_service', side_effect=_create)