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

@@ -3,9 +3,9 @@ import pytest
from app.main.forms import get_placeholder_form_instance
def test_form_class_not_mutated(app_):
def test_form_class_not_mutated(notify_admin):
with app_.test_request_context(
with notify_admin.test_request_context(
method='POST',
data={'placeholder_value': ''}
):
@@ -46,14 +46,14 @@ def test_form_class_not_mutated(app_):
])
def test_validates_recipients(
app_,
notify_admin,
placeholder_name,
template_type,
value,
service_can_send_international_sms,
expected_error,
):
with app_.test_request_context(
with notify_admin.test_request_context(
method='POST',
data={'placeholder_value': value}
):