mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-17 12:29:20 -04:00
Merge branch 'master' into inbound_number_admin
This commit is contained in:
27
tests/app/notify_client/test_billing_client.py
Normal file
27
tests/app/notify_client/test_billing_client.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import uuid
|
||||
|
||||
from app.notify_client.billing_api_client import BillingAPIClient
|
||||
|
||||
|
||||
def test_get_billing_units_calls_correct_endpoint(mocker, api_user_active):
|
||||
service_id = uuid.uuid4()
|
||||
expected_url = '/service/{}/billing/monthly-usage'.format(service_id)
|
||||
|
||||
client = BillingAPIClient()
|
||||
|
||||
mock_get = mocker.patch('app.notify_client.billing_api_client.BillingAPIClient.get')
|
||||
|
||||
client.get_billable_units(service_id, 2017)
|
||||
mock_get.assert_called_once_with(expected_url, params={'year': 2017})
|
||||
|
||||
|
||||
def test_get_get_service_usage_calls_correct_endpoint(mocker, api_user_active):
|
||||
service_id = uuid.uuid4()
|
||||
expected_url = '/service/{}/billing/yearly-usage-summary'.format(service_id)
|
||||
|
||||
client = BillingAPIClient()
|
||||
|
||||
mock_get = mocker.patch('app.notify_client.billing_api_client.BillingAPIClient.get')
|
||||
|
||||
client.get_service_usage(service_id, 2017)
|
||||
mock_get.assert_called_once_with(expected_url, params={'year': 2017})
|
||||
@@ -1505,7 +1505,7 @@ def mock_get_usage(mocker, service_one, fake_uuid):
|
||||
]
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_usage', side_effect=_get_usage)
|
||||
'app.billing_api_client.get_service_usage', side_effect=_get_usage)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
@@ -1605,7 +1605,7 @@ def mock_get_billable_units(mocker):
|
||||
]
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_billable_units', side_effect=_get_usage)
|
||||
'app.billing_api_client.get_billable_units', side_effect=_get_usage)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
@@ -1623,7 +1623,7 @@ def mock_get_future_usage(mocker, service_one, fake_uuid):
|
||||
]
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_service_usage', side_effect=_get_usage)
|
||||
'app.billing_api_client.get_service_usage', side_effect=_get_usage)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
@@ -1632,7 +1632,7 @@ def mock_get_future_billable_units(mocker):
|
||||
return []
|
||||
|
||||
return mocker.patch(
|
||||
'app.service_api_client.get_billable_units', side_effect=_get_usage)
|
||||
'app.billing_api_client.get_billable_units', side_effect=_get_usage)
|
||||
|
||||
|
||||
@pytest.fixture(scope='function')
|
||||
|
||||
Reference in New Issue
Block a user