forked from agentscope-ai/QwenPaw
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_agent_scoped_router.py
More file actions
74 lines (62 loc) · 1.96 KB
/
Copy pathtest_agent_scoped_router.py
File metadata and controls
74 lines (62 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# -*- coding: utf-8 -*-
"""Integration tests for Agent Scoped API endpoints.
Tests cover:
- GET /api/agent-scoped: get agent-scoped settings
- POST /api/agent-scoped: update agent-scoped settings
"""
import pytest
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_get(app_server) -> None:
"""Test GET /api/agent-scoped returns agent-scoped settings."""
response = app_server.api_request(
"GET",
"/api/agents/default/agent-status",
)
assert response.status_code == 200
data = response.json()
assert isinstance(data, dict)
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_update_invalid(app_server) -> None:
"""Test POST /api/agent-scoped with invalid data."""
response = app_server.api_request(
"POST",
"/api/agents/default/cron/jobs",
json={},
)
# Should handle gracefully
assert response.status_code in [200, 400, 422]
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_structure(app_server) -> None:
"""Test agent-scoped response structure."""
response = app_server.api_request(
"GET",
"/api/agents/default/agent-status",
)
assert response.status_code == 200
data = response.json()
assert isinstance(data, dict)
# Should have agent-scoped fields
assert len(data) >= 0
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_update_partial(app_server) -> None:
"""Test POST /api/agent-scoped with partial update."""
# Try to update with empty dict
response = app_server.api_request(
"POST",
"/api/agents/default/cron/jobs",
json={},
)
assert response.status_code == 422
@pytest.mark.integration
@pytest.mark.p1
def test_agent_scoped_get_specific(app_server) -> None:
"""Test GET /api/agent-scoped with specific key."""
response = app_server.api_request(
"GET",
"/api/agents/default/config/channels",
)
assert response.status_code in [200, 404]