Use create_service instead of sample_service when creating service permission for tests

This commit is contained in:
Pea Tyczynska
2018-12-31 14:34:02 +00:00
parent 3306b9fc97
commit 95115e7ae6
2 changed files with 5 additions and 2 deletions

View File

@@ -802,7 +802,7 @@ def sample_user_service_permission(
if user is None:
user = create_user()
if service is None:
service = sample_service(notify_db, notify_db_session, user=user)
service = create_service(user=user)
data = {
'user': user,
'service': service,

View File

@@ -17,7 +17,7 @@ from app.dao.service_data_retention_dao import insert_service_data_retention
from app.dao.service_inbound_api_dao import save_service_inbound_api
from app.dao.service_permissions_dao import dao_add_service_permission
from app.dao.service_sms_sender_dao import update_existing_sms_sender_with_inbound_number, dao_update_service_sms_sender
from app.dao.services_dao import dao_create_service
from app.dao.services_dao import dao_create_service, dao_add_user_to_service
from app.dao.templates_dao import dao_create_template, dao_update_template
from app.dao.users_dao import save_model_user
from app.models import (
@@ -99,6 +99,9 @@ def create_service(
service.active = active
service.research_mode = research_mode
else:
if user not in service.users:
dao_add_user_to_service(service, user)
return service