Diff to HTML by rtfpessoa

Files changed (3) hide show
  1. app-section-1/app/main.py 1969-12-31 17:00:00 → app-section-2/app/main.py 2023-04-08 18:02:03 +10 -0
  2. app-section-1/tests/conftest.py 1969-12-31 17:00:00 → app-section-2/tests/conftest.py 2023-04-13 16:15:28 +9 -0
  3. app-section-1/tests/test_app.py 1969-12-31 17:00:00 → app-section-2/tests/test_app.py 2023-04-02 12:01:33 +8 -0
app-section-1/app/main.py 1969-12-31 17:00:00 → app-section-2/app/main.py 2023-04-08 18:02:03 RENAMED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+
3
+
4
+ app = FastAPI()
5
+
6
+
7
+ @app.get("/")
8
+ def status():
9
+ """Check that the API is working."""
10
+ return "the API is up and running!"
app-section-1/tests/conftest.py 1969-12-31 17:00:00 → app-section-2/tests/conftest.py 2023-04-13 16:15:28 RENAMED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+ from fastapi.testclient import TestClient
3
+
4
+ from app.main import app
5
+
6
+
7
+ @pytest.fixture
8
+ def client() -> TestClient:
9
+ return TestClient(app)
app-section-1/tests/test_app.py 1969-12-31 17:00:00 → app-section-2/tests/test_app.py 2023-04-02 12:01:33 RENAMED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from fastapi.testclient import TestClient
2
+
3
+
4
+ def test_status_endpoint(client: TestClient):
5
+ response = client.get("/")
6
+ assert response.status_code == 200
7
+ payload = response.json()
8
+ assert payload == "the API is up and running!"