Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
112 lines
2.7 KiB
Python
112 lines
2.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Integration tests for the agent-stats router.
|
|
|
|
Covers GET /api/agent-stats with various date range parameters.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
from helpers import default_http_timeout
|
|
|
|
_STATS_TIMEOUT = default_http_timeout(15.0)
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_agent_stats_summary_default_range(app_server) -> None:
|
|
"""Test purpose:
|
|
- Verify GET /api/agent-stats with no parameters returns a valid
|
|
summary for the default 30-day range. Console dashboard renders
|
|
this on load.
|
|
|
|
Test flow:
|
|
1. GET /api/agent-stats with no params.
|
|
2. Assert 200 and response is a dict.
|
|
|
|
API endpoints:
|
|
- GET /api/agent-stats
|
|
"""
|
|
resp = app_server.api_request(
|
|
"GET",
|
|
"/api/agent-stats",
|
|
timeout=_STATS_TIMEOUT,
|
|
)
|
|
assert resp.status_code == 200, app_server.logs_tail()
|
|
payload = resp.json()
|
|
assert isinstance(payload, dict)
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_agent_stats_summary_with_date_range(app_server) -> None:
|
|
"""Test purpose:
|
|
- Verify date range parameters are accepted.
|
|
|
|
Test flow:
|
|
1. GET /api/agent-stats with start_date and end_date.
|
|
2. Assert 200.
|
|
|
|
API endpoints:
|
|
- GET /api/agent-stats
|
|
"""
|
|
resp = app_server.api_request(
|
|
"GET",
|
|
"/api/agent-stats",
|
|
params={
|
|
"start_date": "2026-01-01",
|
|
"end_date": "2026-12-31",
|
|
},
|
|
timeout=_STATS_TIMEOUT,
|
|
)
|
|
assert resp.status_code == 200, app_server.logs_tail()
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_agent_stats_summary_reversed_dates_swapped(app_server) -> None:
|
|
"""Test purpose:
|
|
- Verify that reversed start/end dates are handled gracefully.
|
|
|
|
Test flow:
|
|
1. GET /api/agent-stats with start_date > end_date.
|
|
2. Assert 200.
|
|
|
|
API endpoints:
|
|
- GET /api/agent-stats
|
|
"""
|
|
resp = app_server.api_request(
|
|
"GET",
|
|
"/api/agent-stats",
|
|
params={
|
|
"start_date": "2026-12-31",
|
|
"end_date": "2026-01-01",
|
|
},
|
|
timeout=_STATS_TIMEOUT,
|
|
)
|
|
assert resp.status_code == 200, app_server.logs_tail()
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.p1
|
|
def test_agent_stats_summary_invalid_date_format(app_server) -> None:
|
|
"""Test purpose:
|
|
- Verify invalid date format returns None (falls back to default).
|
|
|
|
Test flow:
|
|
1. GET /api/agent-stats with invalid date string.
|
|
2. Assert 200.
|
|
|
|
API endpoints:
|
|
- GET /api/agent-stats
|
|
"""
|
|
resp = app_server.api_request(
|
|
"GET",
|
|
"/api/agent-stats",
|
|
params={
|
|
"start_date": "not-a-date",
|
|
},
|
|
timeout=_STATS_TIMEOUT,
|
|
)
|
|
assert resp.status_code == 200, app_server.logs_tail()
|