Update tests to use set() otherwise is possible to fail

This commit is contained in:
Imdad Ahad
2017-06-30 11:02:35 +01:00
committed by venusbb
parent 28b17b7716
commit c7ea6ba116

View File

@@ -40,7 +40,8 @@ def test_should_get_all_statuses_for_notifications_associated_with_job(
notify_db,
notify_db_session,
sample_service,
sample_job):
sample_job
):
notification = partial(create_notification, notify_db, notify_db_session, service=sample_service, job=sample_job)
notification(status='created')
notification(status='sending')
@@ -53,7 +54,7 @@ def test_should_get_all_statuses_for_notifications_associated_with_job(
notification(status='sent')
results = dao_get_notification_outcomes_for_job(sample_service.id, sample_job.id)
assert [(row.count, row.status) for row in results] == [
assert set([(row.count, row.status) for row in results]) == set([
(1, 'created'),
(1, 'sending'),
(1, 'delivered'),
@@ -63,17 +64,19 @@ def test_should_get_all_statuses_for_notifications_associated_with_job(
(1, 'temporary-failure'),
(1, 'permanent-failure'),
(1, 'sent')
]
])
def test_should_count_of_statuses_for_notifications_associated_with_job(
notify_db,
notify_db_session,
sample_service,
sample_job):
sample_job
):
notification = partial(create_notification, notify_db, notify_db_session, service=sample_service, job=sample_job)
notification(status='created')
notification(status='created')
notification(status='sending')
notification(status='sending')
notification(status='sending')
@@ -82,11 +85,11 @@ def test_should_count_of_statuses_for_notifications_associated_with_job(
notification(status='delivered')
results = dao_get_notification_outcomes_for_job(sample_service.id, sample_job.id)
assert [(row.count, row.status) for row in results] == [
assert set([(row.count, row.status) for row in results]) == set([
(2, 'created'),
(4, 'sending'),
(2, 'delivered')
]
])
def test_should_return_zero_length_array_if_no_notifications_for_job(sample_service, sample_job):