Skip to content

Commit 40297cd

Browse files
committed
write some tests for APISATR
1 parent af891ec commit 40297cd

File tree

1 file changed

+17
-0
lines changed
  • days/009-012-modern-apis-starred/your_turn

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from apistar import test
2+
3+
from app import app, cars
4+
5+
client = test.TestClient(app)
6+
7+
8+
def test_list_cars():
9+
response = client.get('/')
10+
assert response.status_code == 200
11+
cars = response.json()
12+
assert type(cars) == list
13+
assert len(cars) == 1000
14+
car = cars[0]
15+
assert car == {"id": 1, "manufacturer": "Audi", "model": "S4", "year": 2005, "vin": "WVWED7AJ9CW312992"}
16+
assert cars[-1] == {"id": 1000, "manufacturer": "Cadillac", "model": "Escalade", "year": 2009,
17+
"vin": "WAUYGAFC3CN434486"}

0 commit comments

Comments
 (0)