mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
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
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user