Merge branch 'master' into inbound_number_admin

This commit is contained in:
Rebecca Law
2017-08-21 13:50:49 +01:00
10 changed files with 74 additions and 24 deletions

View 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})

View File

@@ -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')