remove billable-units endpoint

it wasn't used anywhere, and the return value changed when flask was upgraded
This commit is contained in:
Leo Hemsted
2017-08-21 09:41:00 +01:00
parent c36e50bef1
commit c2152f9cb8
5 changed files with 7 additions and 92 deletions

View File

@@ -1184,10 +1184,13 @@ def test_send_inbound_sms_to_service_retries_if_request_returns_500(notify_api,
status_code=500)
send_inbound_sms_to_service(inbound_sms.id, inbound_sms.service_id)
mocked.assert_called_with(
exc='Unable to send_inbound_sms_to_service for service_id: {} '
'and url: {url}. \n500 Server Error: None for url: {url}'.format(sample_service.id, url=inbound_api.url),
queue="retry-tasks")
exc_msg = 'Unable to send_inbound_sms_to_service for service_id: {} and url: {url}'.format(
sample_service.id,
url=inbound_api.url
)
assert mocked.call_count == 1
assert mocked.call_args[1]['queue'] == 'retry-tasks'
assert exc_msg in mocked.call_args[1]['exc']
def test_send_inbound_sms_to_service_does_not_retries_if_request_returns_404(notify_api, sample_service, mocker):

View File

@@ -31,7 +31,6 @@ from app.dao.notifications_dao import (
delete_notifications_created_more_than_a_week_ago_by_type,
get_notification_by_id,
get_notification_for_job,
get_notification_billable_unit_count_per_month,
get_notification_with_personalisation,
get_notifications_for_job,
get_notifications_for_service,
@@ -914,38 +913,6 @@ def test_get_all_notifications_for_job_by_status(notify_db, notify_db_session, s
assert len(notifications(filter_dict={'status': NOTIFICATION_STATUS_TYPES[:3]}).items) == 3
def test_get_notification_billable_unit_count_per_month(notify_db, notify_db_session, sample_service):
for year, month, day, hour, minute, second in (
(2017, 1, 15, 23, 59, 59), # ↓ 2016 financial year
(2016, 9, 30, 23, 59, 59), # counts in October with BST conversion
(2016, 6, 30, 23, 50, 20),
(2016, 7, 15, 9, 20, 25),
(2016, 4, 1, 1, 1, 00),
(2016, 4, 1, 0, 0, 00),
(2016, 3, 31, 23, 00, 1), # counts in April with BST conversion
(2015, 4, 1, 13, 8, 59), # ↓ 2015 financial year
(2015, 11, 20, 22, 40, 45),
(2016, 1, 31, 23, 30, 40) # counts in January no BST conversion in winter
):
sample_notification(
notify_db, notify_db_session, service=sample_service,
created_at=datetime(
year, month, day, hour, minute, second, 0
)
)
for financial_year, months in (
(2017, []),
(2016, [('April', 3), ('July', 2), ('October', 1), ('January', 1)]),
(2015, [('April', 1), ('November', 1), ('January', 1)]),
(2014, [])
):
assert get_notification_billable_unit_count_per_month(
sample_service.id, financial_year
) == months
def test_update_notification_sets_status(sample_notification):
assert sample_notification.status == 'created'
sample_notification.status = 'failed'

View File

@@ -1665,30 +1665,6 @@ def test_get_detailed_services_for_date_range(notify_db, notify_db_session, set_
}
@freeze_time('2012-12-12T12:00:01')
def test_get_notification_billable_unit_count(client, notify_db, notify_db_session):
notification = create_sample_notification(notify_db, notify_db_session)
response = client.get(
'/service/{}/billable-units?year=2012'.format(notification.service_id),
headers=[create_authorization_header()]
)
assert response.status_code == 200
assert json.loads(response.get_data(as_text=True)) == {
'December': 1
}
def test_get_notification_billable_unit_count_missing_year(client, sample_service):
response = client.get(
'/service/{}/billable-units'.format(sample_service.id),
headers=[create_authorization_header()]
)
assert response.status_code == 400
assert json.loads(response.get_data(as_text=True)) == {
'message': 'No valid year provided', 'result': 'error'
}
@pytest.mark.parametrize('query_string, expected_status, expected_json', [
('', 200, {'data': {'email_count': 0, 'sms_count': 0}}),
('?year=2000', 200, {'data': {'email_count': 0, 'sms_count': 0}}),