mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
The admin app now sends the email from when creating a service and when updating the service name.
This PR removes the need for the email_safe function. The api does not create the email_from field for the service. Tests were updated to reflect this change.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
from datetime import datetime
|
||||
from app import (email_safe, db)
|
||||
from app import db
|
||||
from app.models import (
|
||||
User, Service, Template, ApiKey, Job, Notification, InvitedUser, Permission)
|
||||
from app.dao.users_dao import (save_model_user, create_user_code, create_secret_code)
|
||||
@@ -16,16 +16,16 @@ import uuid
|
||||
@pytest.fixture(scope='function')
|
||||
def service_factory(notify_db, notify_db_session):
|
||||
class ServiceFactory(object):
|
||||
def get(self, service_name, user=None, template_type=None):
|
||||
def get(self, service_name, user=None, template_type=None, email_from=None):
|
||||
if not user:
|
||||
user = sample_user(notify_db, notify_db_session)
|
||||
service = sample_service(notify_db, notify_db_session, service_name, user)
|
||||
service = sample_service(notify_db, notify_db_session, service_name, user, email_from=email_from)
|
||||
if template_type == 'email':
|
||||
sample_template(
|
||||
notify_db,
|
||||
notify_db_session,
|
||||
template_type=template_type,
|
||||
subject_line=email_safe(service_name),
|
||||
subject_line=service.email_from,
|
||||
service=service
|
||||
)
|
||||
else:
|
||||
@@ -102,7 +102,8 @@ def sample_service(notify_db,
|
||||
service_name="Sample service",
|
||||
user=None,
|
||||
restricted=False,
|
||||
limit=1000):
|
||||
limit=1000,
|
||||
email_from="sample.service"):
|
||||
if user is None:
|
||||
user = sample_user(notify_db, notify_db_session)
|
||||
data = {
|
||||
@@ -110,7 +111,7 @@ def sample_service(notify_db,
|
||||
'limit': limit,
|
||||
'active': False,
|
||||
'restricted': restricted,
|
||||
'email_from': email_safe(service_name)
|
||||
'email_from': email_from
|
||||
}
|
||||
service = Service.query.filter_by(name=service_name).first()
|
||||
if not service:
|
||||
|
||||
Reference in New Issue
Block a user