We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eceb6ba commit 3116663Copy full SHA for 3116663
1 file changed
backend/tests/test_logs.py
@@ -0,0 +1,23 @@
1
+from fastapi.testclient import TestClient
2
+from backend.main import app
3
+
4
+client = TestClient(app)
5
6
+def test_create_log():
7
+ payload = {
8
+ "timestamp": "2025-01-01T00:00:00Z",
9
+ "source_ip": "10.0.0.1",
10
+ "destination_ip": "10.0.0.2",
11
+ "bytes_sent": 1234,
12
+ "bytes_received": 5678,
13
+ "protocol": "TCP",
14
+ "status": "OK"
15
+ }
16
+ resp = client.post("/logs/", json=payload)
17
+ assert resp.status_code in (200, 201)
18
19
+def test_list_logs():
20
+ resp = client.get("/logs/")
21
+ assert resp.status_code == 200
22
+ data = resp.json()
23
+ assert isinstance(data, list) or isinstance(data, dict)
0 commit comments