test_api.py
1 import json 2 3 import pytest 4 from falcon import testing 5 6 from api import app 7 8 @pytest.fixture 9 def client(): 10 return testing.TestClient(app) 11 12 def test_hello_db(client): 13 response = client.simulate_get("/hello_db", headers={'X-Test-Request': 'true'}) 14 print(response.content) # Printing response is obligatory for debugging 15 assert response.status == "200 OK" 16 assert "message" in json.loads(response.content) 17 assert "data" in json.loads(response.content)