def __init__(self, *args, **kwargs): # noqa super().__init__(*args, **kwargs) if MyTestCase.app is None: MyTestCase.app = create_app() MyTestCase.client = self.app.test_client() if MyTestCase.db is None: setup_db(self.app, self.database_path) MyTestCase.db = db self.db.drop_all() self.db.create_all() self.sample_actor = dict( name='My actor', age=4, gender=0, ) self.bad_actor = dict( name='', # oops, empty name age=42, gender=0, ) self.sample_movie = dict( title='My movie', release_date=date(2021, 3, 30).isoformat(), ) self.bad_movie = dict( title='', release_date=date(2021, 3, 30).isoformat(), ) m = Movie(**self.sample_movie) m.id = 499 m.insert()
"duration": 120, "genre": [{ "id": 1, "name": "Action" }], "id": 2, "name": "Movie Example 2", "poster": "Poster URL 2", "rating": 8.0, "year": 2020 } genre_dict_example = {'id': 1, 'name': 'Action'} # Movie model examples movie_model_example_1 = Movie() movie_model_example_1.id = 1 movie_model_example_1.name = 'Movie Example 1' movie_model_example_1.description = 'Description1' movie_model_example_1.duration = 100 movie_model_example_1.poster = 'Poster URL 1' movie_model_example_1.rating = 7.0 movie_model_example_1.year = 2019 # Instanciate a genre model example genre_model = Genre() genre_model.id = 1 genre_model.name = 'Action' # Append genre example to genre list in movie model movie_model_example_1.genre.append(genre_model) movie_model_example_1.director = 'Director1'