Added changes to support extra day in activity chart (#1928)

This commit is contained in:
Alex Janousek
2025-08-25 16:28:54 -04:00
committed by GitHub
parent c3e5f0b31e
commit 86458fe1a0
6 changed files with 39 additions and 23 deletions

View File

@@ -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,
)

View File

@@ -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"},
],

View File

@@ -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"