mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
refactor tests
re-order notification dao delete notifications test to move "fixtures" to the top of the file changed create_service_data_retention to take an ORM object, not an id. brings it in line with other db.py test functions
This commit is contained in:
@@ -7,10 +7,10 @@ from tests.app.db import create_service_data_retention
|
||||
|
||||
|
||||
def test_get_service_data_retention(client, sample_service):
|
||||
sms_data_retention = create_service_data_retention(service_id=sample_service.id)
|
||||
email_data_retention = create_service_data_retention(service_id=sample_service.id, notification_type='email',
|
||||
sms_data_retention = create_service_data_retention(service=sample_service)
|
||||
email_data_retention = create_service_data_retention(service=sample_service, notification_type='email',
|
||||
days_of_retention=10)
|
||||
letter_data_retention = create_service_data_retention(service_id=sample_service.id, notification_type='letter',
|
||||
letter_data_retention = create_service_data_retention(service=sample_service, notification_type='letter',
|
||||
days_of_retention=30)
|
||||
|
||||
response = client.get(
|
||||
@@ -36,7 +36,7 @@ def test_get_service_data_retention_returns_empty_list(client, sample_service):
|
||||
|
||||
|
||||
def test_get_data_retention_for_service_notification_type(client, sample_service):
|
||||
data_retention = create_service_data_retention(service_id=sample_service.id)
|
||||
data_retention = create_service_data_retention(service=sample_service)
|
||||
response = client.get('/service/{}/data-retention/notification-type/{}'.format(sample_service.id, 'sms'),
|
||||
headers=[('Content-Type', 'application/json'), create_authorization_header()],
|
||||
)
|
||||
@@ -45,10 +45,10 @@ def test_get_data_retention_for_service_notification_type(client, sample_service
|
||||
|
||||
|
||||
def test_get_service_data_retention_by_id(client, sample_service):
|
||||
sms_data_retention = create_service_data_retention(service_id=sample_service.id)
|
||||
create_service_data_retention(service_id=sample_service.id, notification_type='email',
|
||||
sms_data_retention = create_service_data_retention(service=sample_service)
|
||||
create_service_data_retention(service=sample_service, notification_type='email',
|
||||
days_of_retention=10)
|
||||
create_service_data_retention(service_id=sample_service.id, notification_type='letter',
|
||||
create_service_data_retention(service=sample_service, notification_type='letter',
|
||||
days_of_retention=30)
|
||||
response = client.get(
|
||||
'/service/{}/data-retention/{}'.format(str(sample_service.id), sms_data_retention.id),
|
||||
@@ -105,7 +105,7 @@ def test_create_service_data_retention_returns_400_when_notification_type_is_inv
|
||||
def test_create_service_data_retention_returns_400_when_data_retention_for_notification_type_already_exists(
|
||||
client, sample_service
|
||||
):
|
||||
create_service_data_retention(service_id=sample_service.id)
|
||||
create_service_data_retention(service=sample_service)
|
||||
data = {
|
||||
"notification_type": "sms",
|
||||
"days_of_retention": 3
|
||||
@@ -123,7 +123,7 @@ def test_create_service_data_retention_returns_400_when_data_retention_for_notif
|
||||
|
||||
|
||||
def test_modify_service_data_retention(client, sample_service):
|
||||
data_retention = create_service_data_retention(service_id=sample_service.id)
|
||||
data_retention = create_service_data_retention(service=sample_service)
|
||||
data = {
|
||||
"days_of_retention": 3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user