mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-16 16:34:47 -05:00
Add basic tests
This commit is contained in:
33
tests/app/main/test_request_header.py
Normal file
33
tests/app/main/test_request_header.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from tests.conftest import set_config_values
|
||||
|
||||
|
||||
def test_route_correct_secret_key(app_, client):
|
||||
with set_config_values(app_, {
|
||||
'ROUTE_SECRET_KEY_1': 'key_1',
|
||||
'ROUTE_SECRET_KEY_2': '',
|
||||
'DEBUG': False,
|
||||
}):
|
||||
|
||||
response = client.get(
|
||||
path='/_status',
|
||||
headers=[
|
||||
('X-Custom-forwarder', 'key_1'),
|
||||
]
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_route_incorrect_secret_key(app_, client):
|
||||
with set_config_values(app_, {
|
||||
'ROUTE_SECRET_KEY_1': 'key_1',
|
||||
'ROUTE_SECRET_KEY_2': '',
|
||||
'DEBUG': False,
|
||||
}):
|
||||
|
||||
response = client.get(
|
||||
path='/_status',
|
||||
headers=[
|
||||
('X-Custom-forwarder', 'wrong_key'),
|
||||
]
|
||||
)
|
||||
assert response.status_code == 403
|
||||
Reference in New Issue
Block a user