Make a couple of fixtures Pytest 4 compliant

By stopping them from calling other fixtures as functions.
This commit is contained in:
Katie Smith
2019-09-18 12:01:20 +01:00
parent 62735ea125
commit a2c25cec9f

View File

@@ -272,17 +272,15 @@ def sample_template_without_letter_permission(notify_db, notify_db_session):
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
def sample_template_with_placeholders(notify_db, notify_db_session): def sample_template_with_placeholders(sample_service):
# deliberate space and title case in placeholder # deliberate space and title case in placeholder
return sample_template(notify_db, notify_db_session, content="Hello (( Name))\nYour thing is due soon") return create_template(sample_service, content="Hello (( Name))\nYour thing is due soon")
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
def sample_sms_template_with_html(notify_db, notify_db_session): def sample_sms_template_with_html(sample_service):
# deliberate space and title case in placeholder # deliberate space and title case in placeholder
return sample_template(notify_db, notify_db_session, content=( return create_template(sample_service, content="Hello (( Name))\nHere is <em>some HTML</em> & entities")
"Hello (( Name))\nHere is <em>some HTML</em> & entities"
))
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
@@ -411,31 +409,20 @@ def sample_job(
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
def sample_job_with_placeholdered_template( def sample_job_with_placeholdered_template(
notify_db, sample_job,
notify_db_session, sample_template_with_placeholders,
service=None
): ):
return sample_job( sample_job.template = sample_template_with_placeholders
notify_db,
notify_db_session, return sample_job
service=service,
template=sample_template_with_placeholders(notify_db, notify_db_session)
)
@pytest.fixture(scope='function') @pytest.fixture(scope='function')
def sample_scheduled_job( def sample_scheduled_job(sample_template_with_placeholders):
notify_db, return create_job(
notify_db_session, sample_template_with_placeholders,
service=None job_status='scheduled',
): scheduled_for=(datetime.utcnow() + timedelta(minutes=60)).isoformat()
return sample_job(
notify_db,
notify_db_session,
service=service,
template=sample_template_with_placeholders(notify_db, notify_db_session),
scheduled_for=(datetime.utcnow() + timedelta(minutes=60)).isoformat(),
job_status='scheduled'
) )