mirror of
https://github.com/mblanke/ThreatHunt.git
synced 2026-03-01 14:00:20 -05:00
- Implemented PlaybookManager for creating and managing investigation playbooks with templates. - Added SavedSearches component for managing bookmarked queries and recurring scans. - Introduced TimelineView for visualizing forensic event timelines with zoomable charts. - Enhanced backend processing with auto-queued jobs for dataset uploads and improved database concurrency. - Updated frontend components for better user experience and performance optimizations. - Documented changes in update log for future reference.
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
from pathlib import Path
|
|
p=Path(r'd:/Projects/Dev/ThreatHunt/backend/tests/test_api.py')
|
|
t=p.read_text(encoding='utf-8')
|
|
insert='''
|
|
async def test_hunt_progress(self, client):
|
|
create = await client.post("/api/hunts", json={"name": "Progress Hunt"})
|
|
hunt_id = create.json()["id"]
|
|
|
|
# attach one dataset so progress has scope
|
|
from tests.conftest import SAMPLE_CSV
|
|
import io
|
|
files = {"file": ("progress.csv", io.BytesIO(SAMPLE_CSV), "text/csv")}
|
|
up = await client.post(f"/api/datasets/upload?hunt_id={hunt_id}", files=files)
|
|
assert up.status_code == 200
|
|
|
|
res = await client.get(f"/api/hunts/{hunt_id}/progress")
|
|
assert res.status_code == 200
|
|
body = res.json()
|
|
assert body["hunt_id"] == hunt_id
|
|
assert "progress_percent" in body
|
|
assert "dataset_total" in body
|
|
assert "network_status" in body
|
|
'''
|
|
needle=''' async def test_get_nonexistent_hunt(self, client):
|
|
resp = await client.get("/api/hunts/nonexistent-id")
|
|
assert resp.status_code == 404
|
|
'''
|
|
if needle in t and 'test_hunt_progress' not in t:
|
|
t=t.replace(needle, needle+'\n'+insert)
|
|
p.write_text(t,encoding='utf-8')
|
|
print('updated test_api.py')
|