ensure no tests share the same name (using flake8's checker)

This commit is contained in:
Leo Hemsted
2017-11-27 15:36:57 +00:00
parent 3ee351b802
commit 043dee5a54
5 changed files with 23 additions and 53 deletions

View File

@@ -477,7 +477,7 @@ def test_should_not_update_status_by_reference_if_from_country_with_no_delivery_
assert notification.status == NOTIFICATION_SENT
def test_should_not_update_status_by_id_if_sent_to_country_with_no_delivery_receipts(sample_template):
def test_should_not_update_status_by_id_if_sent_to_country_with_carrier_delivery_receipts(sample_template):
notification = create_notification(
sample_template,
status=NOTIFICATION_SENT,
@@ -491,7 +491,7 @@ def test_should_not_update_status_by_id_if_sent_to_country_with_no_delivery_rece
assert notification.status == NOTIFICATION_SENT
def test_should_not_update_status_by_id_if_sent_to_country_with_no_delivery_receipts(sample_template):
def test_should_not_update_status_by_id_if_sent_to_country_with_delivery_receipts(sample_template):
notification = create_notification(
sample_template,
status=NOTIFICATION_SENT,
@@ -2071,7 +2071,7 @@ def test_dao_get_last_notification_added_for_job_id_no_notifications(sample_temp
assert dao_get_last_notification_added_for_job_id(job.id) is None
def test_dao_get_last_notification_added_for_job_id_no_notifications(sample_template, fake_uuid):
def test_dao_get_last_notification_added_for_job_id_no_job(sample_template, fake_uuid):
assert dao_get_last_notification_added_for_job_id(fake_uuid) is None

View File

@@ -93,15 +93,17 @@ def test_dao_allocate_number_for_service(notify_db_session):
assert updated_inbound_number.service_id == service.id
def test_dao_allocate_number_for_service(notify_db_session, sample_service):
def test_dao_allocate_number_for_service_raises_if_inbound_number_already_taken(notify_db_session, sample_service):
number = '078945612'
inbound_number = create_inbound_number(number=number, service_id=sample_service.id)
service = create_service(service_name="Service needs an inbound number")
with pytest.raises(Exception):
with pytest.raises(Exception) as exc:
dao_allocate_number_for_service(service_id=service.id, inbound_number_id=inbound_number.id)
assert 'is not available' in str(exc.value)
def test_dao_allocate_number_for_service(notify_db_session, sample_service):
def test_dao_allocate_number_for_service_raises_if_invalid_inbound_number(notify_db_session, fake_uuid):
service = create_service(service_name="Service needs an inbound number")
with pytest.raises(Exception):
dao_allocate_number_for_service(service_id=service.id, inbound_number_id=uuid.uuid4())
with pytest.raises(Exception) as exc:
dao_allocate_number_for_service(service_id=service.id, inbound_number_id=fake_uuid)
assert 'is not available' in str(exc.value)

View File

@@ -426,7 +426,7 @@ def test_should_get_jobs_seven_days_old_filters_type(notify_db, notify_db_sessio
assert job_to_remain.id not in [job.id for job in jobs]
def test_dao_get_job_statistics_for_job(notify_db, notify_db_session, sample_job):
def test_dao_get_job_statistics_for_job_calculates_stats(notify_db, notify_db_session, sample_job):
notification = create_notification(notify_db=notify_db, notify_db_session=notify_db_session, job=sample_job)
notification_delivered = create_notification(notify_db=notify_db, notify_db_session=notify_db_session,
job=sample_job, status='delivered')
@@ -438,16 +438,19 @@ def test_dao_get_job_statistics_for_job(notify_db, notify_db_session, sample_job
create_or_update_job_sending_statistics(notification_failed)
update_job_stats_outcome_count(notification_delivered)
update_job_stats_outcome_count(notification_failed)
result = dao_get_job_statistics_for_job(sample_job.service_id, sample_job.id)
assert_job_stat(job=sample_job, result=result, sent=3, delivered=1, failed=1)
def test_dao_get_job_statistics_for_job(notify_db, notify_db_session, sample_service):
def test_dao_get_job_statistics_for_job_separates_jobs(notify_db, notify_db_session, sample_service):
job_1, job_2 = stats_set_up(notify_db, notify_db_session, sample_service)
result = dao_get_job_statistics_for_job(sample_service.id, job_1.id)
assert_job_stat(job=job_1, result=result, sent=2, delivered=1, failed=0)
result = dao_get_job_statistics_for_job(sample_service.id, job_1.id)
result_2 = dao_get_job_statistics_for_job(sample_service.id, job_2.id)
assert_job_stat(job=job_1, result=result, sent=2, delivered=1, failed=0)
assert_job_stat(job=job_2, result=result_2, sent=1, delivered=0, failed=1)