add send_notification file for handling sending one off messages

currently, they're made by creating a one-line job, but we want to
reduce task/csv file noise so we're moving them to persist in the
same vein as API usage. However, we can't just call through to that
since there are some differences:

* no api keys
* tighter control over API format
* no scheduling
* no client references

etc.

So, re-using as much of the v2 validation stuff as possible, I've
created this file that just does basic validation, and then calls
through to persist_notification and schedules a task. Woo.
This commit is contained in:
Leo Hemsted
2017-06-13 17:33:04 +01:00
parent 9f307fd1c5
commit 10b851b456
5 changed files with 105 additions and 33 deletions

View File

@@ -12,13 +12,14 @@ from app import encryption
from app.dao.users_dao import save_model_user
from app.dao.services_dao import dao_remove_user_from_service
from app.models import (
Organisation, Rate, Service, ServicePermission, User,
User, Organisation, Rate, Service, ServicePermission,
DVLA_ORG_LAND_REGISTRY,
KEY_TYPE_NORMAL, KEY_TYPE_TEAM, KEY_TYPE_TEST,
EMAIL_TYPE, SMS_TYPE, LETTER_TYPE, INTERNATIONAL_SMS_TYPE, INBOUND_SMS_TYPE,
DVLA_ORG_LAND_REGISTRY
)
from tests import create_authorization_header
from tests.app.db import create_template, create_service_inbound_api
from tests.app.db import create_template, create_service_inbound_api, create_user
from tests.app.conftest import (
sample_service as create_service,
sample_user_service_permission as create_user_service_permission,
@@ -27,8 +28,6 @@ from tests.app.conftest import (
sample_notification_with_job
)
from tests.app.db import create_user
def test_get_service_list(client, service_factory):
service_factory.get('one')