Пример #1
0
 def test_create_author(self, mock_db):
     mock_db.__enter__.return_value = self.db
     response = app.test_client().post("/authors/",
                                       json={
                                           'first_name': "Damian",
                                           'last_name': "Ziobro",
                                       })
     print(f"DAMIAN: {response.data}")
     author_id = response.json.get('author_id')
     self.assertEqual(response.status_code, 200)
Пример #2
0
 def test_get_all_authors_return(self, mock_db):
     mock_db.__enter__.return_value = self.db
     response = app.test_client().get("/authors/")
     self.assertEqual(response.status_code, 200)
Пример #3
0
 def test_non_existing_path(self):
     response = app.test_client().get("/non-existing")
     self.assertEqual(response.status_code, 404)
Пример #4
0
 def test_root_path(self, mock_db):
     mock_db.__enter__.return_value = self.db
     response = app.test_client().get("/")
     self.assertEqual(response.status_code, 200)