-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_public.py
More file actions
50 lines (40 loc) · 1.52 KB
/
Copy pathtest_public.py
File metadata and controls
50 lines (40 loc) · 1.52 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
"""Tests for public API endpoints."""
async def test_maintainers_empty(client):
response = await client.get("/api/maintainers")
assert response.status_code == 200
assert response.json() == []
async def test_maintainers_with_admin(client, admin_user):
response = await client.get("/api/maintainers")
assert response.status_code == 200
data = response.json()
assert len(data) == 1
assert data[0]["github_username"] == "test_admin"
assert data[0]["is_active"] is True
async def test_memray_status_healthy(client):
response = await client.get("/api/memray-status")
assert response.status_code == 200
data = response.json()
assert data["has_failures"] is False
assert data["failure_count"] == 0
assert data["affected_environments"] == []
async def test_memray_status_with_failure(
client, auth_headers, sample_binary, sample_environment
):
# Report a failure first
await client.post(
"/api/report-memray-failure",
json={
"commit_sha": "c" * 40,
"commit_timestamp": "2025-06-16T10:00:00",
"binary_id": "default",
"environment_id": "linux-x86_64",
"error_message": "memray install failed",
},
headers=auth_headers,
)
response = await client.get("/api/memray-status")
assert response.status_code == 200
data = response.json()
assert data["has_failures"] is True
assert data["failure_count"] == 1
assert data["affected_environments"][0]["binary_id"] == "default"