mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 08:40:29 -04:00
Added changes to support extra day in activity chart (#1928)
This commit is contained in:
@@ -138,7 +138,11 @@ def test_create_template_folder_with_creator_id_grants_permission_to_creator(
|
||||
resp = admin_request.post(
|
||||
"template_folder.create_template_folder",
|
||||
service_id=sample_service.id,
|
||||
_data={"name": "creator folder", "parent_id": None, "created_by_id": str(user_1.id)},
|
||||
_data={
|
||||
"name": "creator folder",
|
||||
"parent_id": None,
|
||||
"created_by_id": str(user_1.id),
|
||||
},
|
||||
_expected_status=201,
|
||||
)
|
||||
|
||||
|
||||
@@ -15,9 +15,8 @@ from tests.app.db import create_ft_notification_status, create_notification
|
||||
@pytest.mark.parametrize(
|
||||
"query_string",
|
||||
[
|
||||
{},
|
||||
{"whole_days": -1},
|
||||
{"whole_days": 8},
|
||||
{"whole_days": 9},
|
||||
{"whole_days": 3.5},
|
||||
{"whole_days": "blurk"},
|
||||
],
|
||||
|
||||
@@ -1,30 +1,42 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('notify_db_session')
|
||||
@pytest.mark.usefixtures("notify_db_session")
|
||||
class TestSecurityHeaders:
|
||||
"""Test security headers for ZAP scan compliance."""
|
||||
|
||||
def test_options_request_returns_204_with_cors_headers(self, client):
|
||||
"""Test that OPTIONS requests return 204 with proper CORS headers."""
|
||||
response = client.options('/')
|
||||
response = client.options("/")
|
||||
|
||||
assert response.status_code == 204
|
||||
assert response.headers.get('Access-Control-Allow-Origin') == '*'
|
||||
assert response.headers.get('Access-Control-Allow-Methods') == 'GET, POST, PUT, DELETE, OPTIONS'
|
||||
assert response.headers.get('Access-Control-Allow-Headers') == 'Content-Type, Authorization'
|
||||
assert response.headers.get('Access-Control-Max-Age') == '3600'
|
||||
assert response.headers.get("Access-Control-Allow-Origin") == "*"
|
||||
assert (
|
||||
response.headers.get("Access-Control-Allow-Methods")
|
||||
== "GET, POST, PUT, DELETE, OPTIONS"
|
||||
)
|
||||
assert (
|
||||
response.headers.get("Access-Control-Allow-Headers")
|
||||
== "Content-Type, Authorization"
|
||||
)
|
||||
assert response.headers.get("Access-Control-Max-Age") == "3600"
|
||||
|
||||
@pytest.mark.parametrize("endpoint", [
|
||||
'/_status',
|
||||
'/_status?simple=1',
|
||||
'/_status/live-service-and-organization-counts'
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"endpoint",
|
||||
[
|
||||
"/_status",
|
||||
"/_status?simple=1",
|
||||
"/_status/live-service-and-organization-counts",
|
||||
],
|
||||
)
|
||||
def test_status_endpoints_have_cache_control_headers(self, client, endpoint):
|
||||
"""Test that all status endpoints have proper cache-control headers."""
|
||||
response = client.get(endpoint)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.headers.get('Cache-Control') == 'no-cache, no-store, must-revalidate'
|
||||
assert response.headers.get('Pragma') == 'no-cache'
|
||||
assert response.headers.get('Expires') == '0'
|
||||
assert (
|
||||
response.headers.get("Cache-Control")
|
||||
== "no-cache, no-store, must-revalidate"
|
||||
)
|
||||
assert response.headers.get("Pragma") == "no-cache"
|
||||
assert response.headers.get("Expires") == "0"
|
||||
|
||||
Reference in New Issue
Block a user