Rename "app_" fixture to "notify_admin"

This naming was introduced in 2016 without explanation [1]. I find it
confusing because:

- It's reminiscent of "_app", which is a Python convention indicating
the variable is internal, so maybe avoid using it.

- It suggests there's some other "app" fixture I should be using (there
isn't, though).

The Python style guide describes using an underscore suffix to avoid
clashes with inbuilt names [1], which is sort of applicable if we need
to import the "app" module [2]. However, we can also avoid clashes by
choosing a different name, without the strange underscore.

[1]: 3b1d521c10
[2]: 78824f54fd/tests/app/main/views/test_forgot_password.py (L5)
This commit is contained in:
Ben Thorner
2021-05-12 14:57:21 +01:00
parent 03295eb828
commit 5bfce61bcf
30 changed files with 163 additions and 164 deletions

View File

@@ -71,7 +71,7 @@ def test_client_activates_if_pending(mocker, api_user_pending):
def test_client_passes_admin_url_when_sending_email_auth(
app_,
notify_admin,
mocker,
fake_uuid,
):
@@ -88,7 +88,7 @@ def test_client_passes_admin_url_when_sending_email_auth(
)
def test_client_converts_admin_permissions_to_db_permissions_on_edit(app_, mocker):
def test_client_converts_admin_permissions_to_db_permissions_on_edit(notify_admin, mocker):
mock_post = mocker.patch('app.notify_client.user_api_client.UserApiClient.post')
user_api_client.set_user_permissions('user_id', 'service_id', permissions={'send_messages', 'view_activity'})
@@ -101,7 +101,7 @@ def test_client_converts_admin_permissions_to_db_permissions_on_edit(app_, mocke
], key=lambda x: x['permission'])
def test_client_converts_admin_permissions_to_db_permissions_on_add_to_service(app_, mocker):
def test_client_converts_admin_permissions_to_db_permissions_on_add_to_service(notify_admin, mocker):
mock_post = mocker.patch('app.notify_client.user_api_client.UserApiClient.post', return_value={'data': {}})
user_api_client.add_user_to_service('service_id',
@@ -155,7 +155,7 @@ def test_client_converts_admin_permissions_to_db_permissions_on_add_to_service(a
]
)
def test_returns_value_from_cache(
app_,
notify_admin,
mocker,
expected_cache_get_calls,
cache_value,
@@ -201,7 +201,7 @@ def test_returns_value_from_cache(
(invite_api_client, 'accept_invite', [SERVICE_ONE_ID, user_id], {}),
])
def test_deletes_user_cache(
app_,
notify_admin,
mock_get_user,
mocker,
client,