mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Normalize whitespace in test arguments
We have a bunch of different styles of handling when function definitions span multiple lines, which they almost always do with tests. Here’s why an argument per line, single indent is best: - cleaner diffs when you change the name of a method (one line change instead of multiple lines) - works better on narrow screens, eg Github’s diff view, or with two terminals side by side on a laptop screen - works with any editor’s indenting shortcuts, no need for an IDE Also, trailing comma in the list of arguments is good because adding a new argument to a method becomes a one line, not two line diff.
This commit is contained in:
@@ -10,7 +10,9 @@ from tests import service_json
|
||||
from app.main.views.platform_admin import format_stats_by_service, create_global_stats
|
||||
|
||||
|
||||
def test_should_redirect_if_not_logged_in(app_):
|
||||
def test_should_redirect_if_not_logged_in(
|
||||
app_
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
response = client.get(url_for('main.platform_admin'))
|
||||
@@ -18,7 +20,11 @@ def test_should_redirect_if_not_logged_in(app_):
|
||||
assert url_for('main.index', _external=True) in response.location
|
||||
|
||||
|
||||
def test_should_403_if_not_platform_admin(app_, active_user_with_permissions, mocker):
|
||||
def test_should_403_if_not_platform_admin(
|
||||
app_,
|
||||
active_user_with_permissions,
|
||||
mocker,
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
mock_get_user(mocker, user=active_user_with_permissions)
|
||||
@@ -44,7 +50,7 @@ def test_should_show_research_and_restricted_mode(
|
||||
platform_admin_user,
|
||||
mocker,
|
||||
mock_get_detailed_services,
|
||||
fake_uuid
|
||||
fake_uuid,
|
||||
):
|
||||
services = [service_json(fake_uuid, 'My Service', [], restricted=restricted, research_mode=research_mode)]
|
||||
services[0]['statistics'] = create_stats()
|
||||
@@ -95,7 +101,7 @@ def test_platform_admin_toggle_including_from_test_key(
|
||||
app_,
|
||||
platform_admin_user,
|
||||
mocker,
|
||||
mock_get_detailed_services
|
||||
mock_get_detailed_services,
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
@@ -111,7 +117,7 @@ def test_platform_admin_with_date_filter(
|
||||
app_,
|
||||
platform_admin_user,
|
||||
mocker,
|
||||
mock_get_detailed_services
|
||||
mock_get_detailed_services,
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
@@ -124,10 +130,12 @@ def test_platform_admin_with_date_filter(
|
||||
assert 'Platform admin' in resp_data
|
||||
assert 'Live services' in resp_data
|
||||
assert 'Trial mode services' in resp_data
|
||||
mock_get_detailed_services.assert_called_once_with({'include_from_test_key': False,
|
||||
'start_date': datetime.date(2016, 12, 20),
|
||||
'end_date': datetime.date(2016, 12, 28),
|
||||
'detailed': True})
|
||||
mock_get_detailed_services.assert_called_once_with({
|
||||
'include_from_test_key': False,
|
||||
'start_date': datetime.date(2016, 12, 20),
|
||||
'end_date': datetime.date(2016, 12, 28),
|
||||
'detailed': True,
|
||||
})
|
||||
|
||||
|
||||
def test_create_global_stats_sets_failure_rates(fake_uuid):
|
||||
@@ -220,7 +228,7 @@ def test_should_show_email_and_sms_stats_for_all_service_types(
|
||||
platform_admin_user,
|
||||
mocker,
|
||||
mock_get_detailed_services,
|
||||
fake_uuid
|
||||
fake_uuid,
|
||||
):
|
||||
services = [service_json(fake_uuid, 'My Service', [], restricted=restricted, research_mode=research_mode)]
|
||||
services[0]['statistics'] = create_stats(
|
||||
@@ -268,7 +276,7 @@ def test_should_show_archived_services_last(
|
||||
mocker,
|
||||
mock_get_detailed_services,
|
||||
restricted,
|
||||
table_index
|
||||
table_index,
|
||||
):
|
||||
services = [
|
||||
service_json(name='C', restricted=restricted, active=False, created_at='2002-02-02 12:00:00'),
|
||||
@@ -302,7 +310,7 @@ def test_shows_archived_label_instead_of_live_or_research_mode_label(
|
||||
platform_admin_user,
|
||||
mocker,
|
||||
mock_get_detailed_services,
|
||||
research_mode
|
||||
research_mode,
|
||||
):
|
||||
services = [
|
||||
service_json(restricted=False, research_mode=research_mode, active=False)
|
||||
@@ -328,7 +336,7 @@ def test_should_show_correct_sent_totals_for_platform_admin(
|
||||
platform_admin_user,
|
||||
mocker,
|
||||
mock_get_detailed_services,
|
||||
fake_uuid
|
||||
fake_uuid,
|
||||
):
|
||||
services = [service_json(fake_uuid, 'My Service', [])]
|
||||
services[0]['statistics'] = create_stats(
|
||||
|
||||
Reference in New Issue
Block a user