mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
update letter tests to use correct service
previously they were using sample_service fixture under the hood, but with full permissions added - this works fine, **unless** there's already a service with the name "sample service" in the database. This can happen for two reasons: * A previous test didn't tear down correctly * This test already invoked the sample_service fixture somehow If this happens, we just return the existing service, without modifying its values - values that we might change in tests, such as research mode or letters permissions. In the future, we'll have to be vigilant! and aware! and careful! to not use sample_service if we're doing tests involving letters, since they create a service with a different name now
This commit is contained in:
@@ -187,7 +187,7 @@ def test_create_job_returns_403_if_service_is_not_active(client, fake_uuid, samp
|
||||
|
||||
|
||||
def test_create_job_returns_403_if_letter_template_type_and_service_in_trial(
|
||||
client, fake_uuid, sample_service, sample_trial_letter_template, mocker):
|
||||
client, fake_uuid, sample_trial_letter_template, mocker):
|
||||
data = {
|
||||
'id': fake_uuid,
|
||||
'service': str(sample_trial_letter_template.service.id),
|
||||
@@ -198,7 +198,7 @@ def test_create_job_returns_403_if_letter_template_type_and_service_in_trial(
|
||||
}
|
||||
mock_job_dao = mocker.patch("app.dao.jobs_dao.dao_create_job")
|
||||
auth_header = create_authorization_header()
|
||||
response = client.post('/service/{}/job'.format(sample_service.id),
|
||||
response = client.post('/service/{}/job'.format(sample_trial_letter_template.service.id),
|
||||
data=json.dumps(data),
|
||||
headers=[('Content-Type', 'application/json'), auth_header])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user