cosmit: intresting test first

This commit is contained in:
Colin Goutte 2023-08-26 17:36:22 +02:00
parent 6e77545ef9
commit 6bbea876a0
1 changed files with 11 additions and 10 deletions

View File

@ -55,6 +55,17 @@ class BaseCrud(unittest.TestCase):
response = client.get("/movies/-1")
assert response.status_code == 404
def test_create_movie_api(self):
name = f"rand_{random.randint(1, 1000)}"
response = client.post("/movies/", json={"title": name})
assert response.status_code == 200
movie_id = response.json()["id"]
assert f"Created {name}" in response.json()["message"]
response = client.get(f"/movies/{movie_id}")
assert response.json()["title"] == name
def test_list_movies(self):
response = client.get("/movies/")
# assert response.json() == []
@ -73,16 +84,6 @@ class BaseCrud(unittest.TestCase):
found = list(movies_by_title[title] for title in names)
assert all(movies_by_title[title] for title in names)
def test_create_movie_api(self):
name = f"rand_{random.randint(1, 1000)}"
response = client.post("/movies/", json={"title": name})
assert response.status_code == 200
movie_id = response.json()["id"]
assert f"Created {name}" in response.json()["message"]
response = client.get(f"/movies/{movie_id}")
assert response.json()["title"] == name
class ApiTestCase(unittest.TestCase):
def test_payload_content_in_and_out_loopback(self):