fix(ci): Fix linting and add missing OpenAPI schema for test data endpoint

- Fixed isort import ordering in test_data_routes.py (stdlib imports before local)
- Added /api/admin/generate-test-data endpoint to frontend openapi.json
- Added GenerateTestDataRequest, GenerateTestDataResponse, and TestDataScriptType schemas

Co-authored-by: Nicholas Tindle <ntindle@users.noreply.github.com>
This commit is contained in:
claude[bot]
2026-02-05 05:41:38 +00:00
parent 2f063fd99b
commit 3d68dd5e69
2 changed files with 80 additions and 4 deletions

View File

@@ -93,19 +93,21 @@ async def generate_test_data(
try:
if request.script_type == TestDataScriptType.E2E:
from backend.data.db import prisma
# Import and run the E2E test data creator
# We need to import within the function to avoid circular imports
import sys
from pathlib import Path
from backend.data.db import prisma
# Add the test directory to the path
test_dir = Path(__file__).parent.parent.parent.parent.parent / "test"
sys.path.insert(0, str(test_dir))
try:
from e2e_test_data import TestDataCreator # type: ignore[import-not-found]
from e2e_test_data import (
TestDataCreator, # type: ignore[import-not-found]
)
# Connect to database if not already connected
if not prisma.is_connected():
@@ -140,7 +142,9 @@ async def generate_test_data(
sys.path.insert(0, str(test_dir))
try:
from test_data_creator import main as create_full_test_data # type: ignore[import-not-found]
from test_data_creator import (
main as create_full_test_data, # type: ignore[import-not-found]
)
await create_full_test_data()

View File

@@ -75,6 +75,47 @@
"security": [{ "HTTPBearerJWT": [] }]
}
},
"/api/admin/generate-test-data": {
"post": {
"tags": ["v2", "admin"],
"summary": "Generate Test Data",
"operationId": "postAdminGenerateTestData",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerateTestDataRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenerateTestDataResponse"
}
}
}
},
"401": {
"$ref": "#/components/responses/HTTP401NotAuthenticatedError"
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": { "$ref": "#/components/schemas/HTTPValidationError" }
}
}
}
},
"security": [{ "HTTPBearerJWT": [] }]
}
},
"/api/api-keys": {
"get": {
"tags": ["v1", "api-keys"],
@@ -7032,6 +7073,32 @@
"required": ["name", "description"],
"title": "Graph"
},
"GenerateTestDataRequest": {
"properties": {
"script_type": {
"allOf": [{ "$ref": "#/components/schemas/TestDataScriptType" }],
"default": "e2e"
}
},
"type": "object",
"title": "GenerateTestDataRequest"
},
"GenerateTestDataResponse": {
"properties": {
"success": { "type": "boolean", "title": "Success" },
"message": { "type": "string", "title": "Message" },
"details": {
"anyOf": [
{ "type": "object", "additionalProperties": true },
{ "type": "null" }
],
"title": "Details"
}
},
"type": "object",
"required": ["success", "message"],
"title": "GenerateTestDataResponse"
},
"GraphExecution": {
"properties": {
"id": { "type": "string", "title": "Id" },
@@ -9939,6 +10006,11 @@
],
"title": "SuggestionsResponse"
},
"TestDataScriptType": {
"type": "string",
"enum": ["full", "e2e"],
"title": "TestDataScriptType"
},
"TimezoneResponse": {
"properties": {
"timezone": {