We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c0cedb commit fff20b0Copy full SHA for fff20b0
1 file changed
api/test_main.py
@@ -0,0 +1,17 @@
1
+from fastapi.testclient import TestClient
2
+from main import app
3
+
4
+client = TestClient(app)
5
6
+def test_generate_qr():
7
+ url = "http://example.com"
8
+ response = client.post("/generate-qr/", json={"url": url})
9
10
+ assert response.status_code == 200
11
+ assert "qr_code_url" in response.json()
12
13
+def test_generate_qr_invalid_url():
14
+ url = "invalid-url"
15
16
17
+ assert response.status_code == 422 # FastAPI validation error
0 commit comments