Refactor code for dao_fetch_servies_by_sms_sender to use inbound_numbers

This will need to be refactored after the deployment of api and admin and after the update script for existing services using inbound numbers has been executed.
This commit is contained in:
Ken Tsang
2017-08-16 12:27:42 +01:00
parent ce962380e3
commit c36423aac6
5 changed files with 113 additions and 22 deletions

View File

@@ -25,9 +25,10 @@ from app.models import (
ProviderDetailsHistory,
ProviderRates,
NotificationStatistics,
ScheduledNotification,
ServiceWhitelist,
KEY_TYPE_NORMAL, KEY_TYPE_TEST, KEY_TYPE_TEAM,
MOBILE_TYPE, EMAIL_TYPE, SMS_TYPE, LETTER_TYPE, NOTIFICATION_STATUS_TYPES_COMPLETED, ScheduledNotification,
MOBILE_TYPE, EMAIL_TYPE, INBOUND_SMS_TYPE, SMS_TYPE, LETTER_TYPE, NOTIFICATION_STATUS_TYPES_COMPLETED,
SERVICE_PERMISSION_TYPES)
from app.dao.users_dao import (create_user_code, create_secret_code)
from app.dao.services_dao import (dao_create_service, dao_add_user_to_service)
@@ -156,12 +157,18 @@ def sample_service(
else:
if user not in service.users:
dao_add_user_to_service(service, user)
if INBOUND_SMS_TYPE in permissions:
create_inbound_number('12345', service_id=service.id)
return service
@pytest.fixture(scope='function')
def sample_service_full_permissions(notify_db, notify_db_session):
return sample_service(notify_db, notify_db_session, permissions=SERVICE_PERMISSION_TYPES)
service = sample_service(notify_db, notify_db_session, permissions=SERVICE_PERMISSION_TYPES)
create_inbound_number('12345', service_id=service.id)
return service
@pytest.fixture(scope='function')