From 92897e20a82bb469efe6832a5f4437ed4d54d847 Mon Sep 17 00:00:00 2001 From: Paul Craig Date: Tue, 22 Nov 2016 17:50:29 +0000 Subject: [PATCH] Test returning a notification with a non-zero cost Our previous test ws returning a notification without a `sent_by` attribute, which meant that cost was always 0. Unfortunately, this meant that returning a real value for cost was untested and (whaddya know) it broke immediately. Old test scenario: - billable_units=1, sent_by=None, cost=0 New scenarios - billable_units=0, sent_by='mmg', cost=0 - billable_units=1, sent_by='mmg', cost=1 --- .../v2/notifications/test_get_notifications.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/app/v2/notifications/test_get_notifications.py b/tests/app/v2/notifications/test_get_notifications.py index a9c583b5b..555490638 100644 --- a/tests/app/v2/notifications/test_get_notifications.py +++ b/tests/app/v2/notifications/test_get_notifications.py @@ -1,12 +1,24 @@ import json +import pytest from app import DATETIME_FORMAT from tests import create_authorization_header +from tests.app.conftest import sample_notification as create_sample_notification -def test_get_notification_by_id_returns_200(client, sample_notification): +@pytest.mark.parametrize('billable_units, provider', [ + (1, 'mmg'), + (0, 'mmg'), + (1, None) +]) +def test_get_notification_by_id_returns_200( + client, notify_db, notify_db_session, sample_provider_rate, billable_units, provider +): + sample_notification = create_sample_notification( + notify_db, notify_db_session, billable_units=billable_units, sent_by=provider + ) + auth_header = create_authorization_header(service_id=sample_notification.service_id) - response = client.get( path='/v2/notifications/{}'.format(sample_notification.id), headers=[('Content-Type', 'application/json'), auth_header])