notify-api-412 use black to enforce python coding style

This commit is contained in:
Kenneth Kehl
2023-08-25 09:12:23 -07:00
parent c6eb007386
commit 8c9721d8e2
201 changed files with 31660 additions and 28105 deletions

View File

@@ -3,24 +3,31 @@ import pytest
from tests.conftest import set_config_values
@pytest.mark.parametrize('check_proxy_header,header_value,expected_code', [
(True, 'key_1', 200),
(True, 'wrong_key', 403),
(False, 'wrong_key', 200),
(False, 'key_1', 200),
])
def test_route_correct_secret_key(notify_admin, check_proxy_header, header_value, expected_code):
with set_config_values(notify_admin, {
'ROUTE_SECRET_KEY_1': 'key_1',
'ROUTE_SECRET_KEY_2': '',
'CHECK_PROXY_HEADER': check_proxy_header,
}):
@pytest.mark.parametrize(
"check_proxy_header,header_value,expected_code",
[
(True, "key_1", 200),
(True, "wrong_key", 403),
(False, "wrong_key", 200),
(False, "key_1", 200),
],
)
def test_route_correct_secret_key(
notify_admin, check_proxy_header, header_value, expected_code
):
with set_config_values(
notify_admin,
{
"ROUTE_SECRET_KEY_1": "key_1",
"ROUTE_SECRET_KEY_2": "",
"CHECK_PROXY_HEADER": check_proxy_header,
},
):
with notify_admin.test_client() as client:
response = client.get(
path='/_status?elb=True',
path="/_status?elb=True",
headers=[
('X-Custom-forwarder', header_value),
]
("X-Custom-forwarder", header_value),
],
)
assert response.status_code == expected_code