File size: 941 Bytes
8c3e275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# SPDX-FileCopyrightText: 2026 Team Centurions
# SPDX-License-Identifier: AGPL-3.0-or-later

from fastapi.testclient import TestClient

from pageparse.web import app

client = TestClient(app)


def test_index():
    resp = client.get("/")
    assert resp.status_code == 200


def test_telemetry():
    resp = client.get("/telemetry")
    assert resp.status_code == 200
    data = resp.json()
    assert "cpu_percent" in data


def test_pages():
    resp = client.get("/pages")
    assert resp.status_code == 200


def test_get_tasks():
    resp = client.get("/tasks")
    assert resp.status_code == 200


def test_get_tasks_with_priority():
    resp = client.get("/tasks?priority=high")
    assert resp.status_code == 200


def test_patch_task():
    resp = client.patch("/tasks/1", json={"status": "done"})
    assert resp.status_code == 200


def test_delete_task():
    resp = client.delete("/tasks/1")
    assert resp.status_code == 200