chore: commit remaining maintenance and model changes
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
# @TEST_CONTRACT: POST /api/maintenance/{id}/end -> 202 {task_id, status}
|
||||
# @TEST_CONTRACT: POST /api/maintenance/end-all -> 202 {task_id, status}
|
||||
# @TEST_EDGE: missing_tables -> 422 validation error
|
||||
# @TEST_EDGE: missing_environment_id -> 422 validation error
|
||||
# @TEST_EDGE: end_time_before_start_time -> 400 validation error
|
||||
# @TEST_EDGE: non_existent_event_end -> 404 not found
|
||||
from datetime import UTC, datetime, timedelta
|
||||
@@ -185,6 +186,27 @@ class TestStartEndpoint:
|
||||
assert response.status_code == 422
|
||||
# #endregion test_start_missing_tables
|
||||
|
||||
# #region test_start_missing_environment_id [C:2] [TYPE Function]
|
||||
# @BRIEF Missing environment_id field returns 422.
|
||||
# @TEST_EDGE: missing_environment_id -> 422 validation error
|
||||
def test_start_missing_environment_id(self, client, mock_db, mock_task_manager):
|
||||
response = client.post(
|
||||
"/api/maintenance/start",
|
||||
json={
|
||||
"tables": ["raw.sales"],
|
||||
"start_time": (datetime.now(UTC) + timedelta(hours=1)).isoformat(),
|
||||
"end_time": (datetime.now(UTC) + timedelta(hours=3)).isoformat(),
|
||||
"message": "Test maintenance",
|
||||
},
|
||||
)
|
||||
assert response.status_code == 422
|
||||
data = response.json()
|
||||
assert any(
|
||||
"environment_id" in str(err.get("loc", []))
|
||||
for err in (data.get("detail", []) if isinstance(data.get("detail"), list) else [])
|
||||
)
|
||||
# #endregion test_start_missing_environment_id
|
||||
|
||||
# #region test_start_end_time_before_start [C:2] [TYPE Function]
|
||||
# @BRIEF end_time before start_time returns 400.
|
||||
def test_start_end_time_before_start(self, client, mock_db, mock_task_manager):
|
||||
|
||||
Reference in New Issue
Block a user