mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
ensure permissions are correct in sample letter fixtures
sample_letter_* should always include a service that has letter permissions. Also, print out the JSON response in the admin_request fixture if the response code doesn't match
This commit is contained in:
@@ -255,8 +255,8 @@ def sample_template_without_email_permission(notify_db, notify_db_session):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sample_letter_template(sample_service):
|
def sample_letter_template(sample_service_full_permissions):
|
||||||
return create_template(sample_service, template_type=LETTER_TYPE)
|
return create_template(sample_service_full_permissions, template_type=LETTER_TYPE)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
@@ -397,17 +397,18 @@ def sample_email_job(notify_db,
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def sample_letter_job(sample_service, sample_letter_template):
|
def sample_letter_job(sample_letter_template):
|
||||||
|
service = sample_letter_template.service
|
||||||
data = {
|
data = {
|
||||||
'id': uuid.uuid4(),
|
'id': uuid.uuid4(),
|
||||||
'service_id': sample_service.id,
|
'service_id': service.id,
|
||||||
'service': sample_service,
|
'service': service,
|
||||||
'template_id': sample_letter_template.id,
|
'template_id': sample_letter_template.id,
|
||||||
'template_version': sample_letter_template.version,
|
'template_version': sample_letter_template.version,
|
||||||
'original_file_name': 'some.csv',
|
'original_file_name': 'some.csv',
|
||||||
'notification_count': 1,
|
'notification_count': 1,
|
||||||
'created_at': datetime.utcnow(),
|
'created_at': datetime.utcnow(),
|
||||||
'created_by': sample_service.created_by,
|
'created_by': service.created_by,
|
||||||
}
|
}
|
||||||
job = Job(**data)
|
job = Job(**data)
|
||||||
dao_create_job(job)
|
dao_create_job(job)
|
||||||
@@ -1026,7 +1027,7 @@ def admin_request(client):
|
|||||||
headers=[('Content-Type', 'application/json'), create_authorization_header()]
|
headers=[('Content-Type', 'application/json'), create_authorization_header()]
|
||||||
)
|
)
|
||||||
json_resp = json.loads(resp.get_data(as_text=True))
|
json_resp = json.loads(resp.get_data(as_text=True))
|
||||||
assert resp.status_code == _expected_status
|
assert resp.status_code == _expected_status, json_resp
|
||||||
return json_resp
|
return json_resp
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -1036,7 +1037,7 @@ def admin_request(client):
|
|||||||
headers=[create_authorization_header()]
|
headers=[create_authorization_header()]
|
||||||
)
|
)
|
||||||
json_resp = json.loads(resp.get_data(as_text=True))
|
json_resp = json.loads(resp.get_data(as_text=True))
|
||||||
assert resp.status_code == _expected_status
|
assert resp.status_code == _expected_status, json_resp
|
||||||
return json_resp
|
return json_resp
|
||||||
|
|
||||||
return AdminRequest
|
return AdminRequest
|
||||||
|
|||||||
Reference in New Issue
Block a user