Delete unused functions and their tests

This commit is contained in:
Katie Smith
2019-03-07 16:44:11 +00:00
parent 99edd15a94
commit e4edddbeab
5 changed files with 1 additions and 127 deletions

View File

@@ -14,7 +14,6 @@ from app.main.views.dashboard import (
aggregate_status_types,
aggregate_template_usage,
format_monthly_stats_to_list,
format_template_stats_to_list,
get_dashboard_totals,
get_free_paid_breakdown_for_billable_units,
get_tuples_of_financial_years,
@@ -1269,48 +1268,6 @@ def test_get_free_paid_breakdown_for_billable_units(now, expected_number_of_mont
][:expected_number_of_months]
def test_format_template_stats_to_list_with_no_stats():
assert list(format_template_stats_to_list({})) == []
def test_format_template_stats_to_list():
counts = {
'created': 1,
'pending': 1,
'delivered': 1,
'failed': 1,
'temporary-failure': 1,
'permanent-failure': 1,
'technical-failure': 1,
'do-not-count': 999,
}
stats_list = list(format_template_stats_to_list({
'template_2_id': {
'counts': {},
'name': 'bar',
},
'template_1_id': {
'counts': counts,
'name': 'foo',
},
}))
# we dont care about the order of this functions output
assert len(stats_list) == 2
assert {
'counts': counts,
'name': 'foo',
'requested_count': 7,
'id': 'template_1_id',
} in stats_list
assert {
'counts': {},
'name': 'bar',
'requested_count': 0,
'id': 'template_2_id',
} in stats_list
def test_get_tuples_of_financial_years():
assert list(get_tuples_of_financial_years(
lambda year: 'http://example.com?year={}'.format(year),

View File

@@ -8,10 +8,7 @@ from flask import url_for
from freezegun import freeze_time
from notifications_python_client.errors import HTTPError
from app.main.views.templates import (
get_human_readable_delta,
get_last_use_message,
)
from app.main.views.templates import get_human_readable_delta
from tests import (
single_notification_json,
template_json,
@@ -1920,23 +1917,6 @@ def test_route_invalid_permissions(
service_one)
def test_get_last_use_message_returns_no_template_message():
assert get_last_use_message('My Template', []) == 'My Template has never been used'
@freeze_time('2000-01-01T15:00')
def test_get_last_use_message_uses_most_recent_statistics():
template_statistics = [
{
'updated_at': '2000-01-01T12:00:00.000000+00:00'
},
{
'updated_at': '2000-01-01T09:00:00.000000+00:00'
},
]
assert get_last_use_message('My Template', template_statistics) == 'My Template was last used 3 hours ago'
@pytest.mark.parametrize('from_time, until_time, message', [
(datetime(2000, 1, 1, 12, 0), datetime(2000, 1, 1, 12, 0, 59), 'under a minute'),
(datetime(2000, 1, 1, 12, 0), datetime(2000, 1, 1, 12, 1), '1 minute'),