notify-admin-866 improve tests with noqa comments

This commit is contained in:
Kenneth Kehl
2023-10-26 08:33:59 -07:00
parent 1c75f9abeb
commit 90025ded54
4 changed files with 10 additions and 18 deletions

View File

@@ -18,11 +18,11 @@ class TestAssetFingerprint(object):
asset_fingerprinter = AssetFingerprinter(asset_root="/suppliers/static/")
assert (
asset_fingerprinter.get_url("application.css")
== "/suppliers/static/application.css?418e6f4a6cdf1142e45c072ed3e1c90a" # noqa
== "/suppliers/static/application.css?418e6f4a6cdf1142e45c072ed3e1c90a"
)
assert (
asset_fingerprinter.get_url("application-ie6.css")
== "/suppliers/static/application-ie6.css?418e6f4a6cdf1142e45c072ed3e1c90a" # noqa
== "/suppliers/static/application-ie6.css?418e6f4a6cdf1142e45c072ed3e1c90a"
)
def test_building_file_path(self, mocker):

View File

@@ -192,18 +192,11 @@ def test_returns_value_from_cache(
assert mock_redis_set.call_args_list == expected_cache_set_calls
@pytest.mark.parametrize( # noqa: PT014 # Duplicate add_user_to_service has different params for each
@pytest.mark.parametrize(
("client", "method", "extra_args", "extra_kwargs"),
[
(
user_api_client,
"add_user_to_service",
[SERVICE_ONE_ID, sample_uuid(), [], []],
{},
),
(user_api_client, "update_user_attribute", [user_id], {}),
(user_api_client, "reset_failed_login_count", [user_id], {}),
(user_api_client, "update_user_attribute", [user_id], {}),
(user_api_client, "update_password", [user_id, "hunter2"], {}),
(user_api_client, "verify_password", [user_id, "hunter2"], {}),
(user_api_client, "check_verify_code", [user_id, "", ""], {}),

View File

@@ -134,8 +134,7 @@ def test_does_not_delete_non_temp_email_file(client_request, mocker):
"app.s3_client.s3_logo_client.delete_s3_object"
)
with pytest.raises(ValueError) as error: # noqa: PT011 # Requires more research.
with pytest.raises(ValueError, match="Not a temp file: logo.png"):
delete_email_temp_file(filename)
assert mocked_delete_s3_object.called is False
assert str(error.value) == "Not a temp file: {}".format(filename)

View File

@@ -5,9 +5,9 @@ from werkzeug.exceptions import Forbidden
from app.utils.user import user_has_permissions
@pytest.mark.parametrize( # noqa: PT007 # Ignoring wrong values type because of the list unpacking in the test.
@pytest.mark.parametrize(
"permissions",
(
[
[
# Route has one of the permissions which the user has
"manage_service"
@@ -25,7 +25,7 @@ from app.utils.user import user_has_permissions
[
# Route has no specific permissions required
],
),
],
)
def test_permissions(
client_request,
@@ -48,14 +48,14 @@ def test_permissions(
index()
@pytest.mark.parametrize( # noqa: PT007 # Ignoring wrong values type because of the list unpacking in the test.
@pytest.mark.parametrize(
"permissions",
(
[
[
# Route has a permission which the user doesnt have
"send_messages"
],
),
],
)
def test_permissions_forbidden(
client_request,