def test_actor_model(): first_actor = Actor(name='ACTOR1', age=10, gender='F') first_actor.save() second_actor = Actor(name='ACTOR2', age=20, gender='M') second_actor.save() saved_actors = Actor.query.all() assert len(saved_actors) == 2 first_saved_actor = Actor.query.get(1) assert first_saved_actor.name == 'ACTOR1' assert first_saved_actor.age == 10 assert first_saved_actor.gender == 'F' second_saved_actor = Actor.query.get(2) assert second_saved_actor.name == 'ACTOR2' assert second_saved_actor.age == 20 assert second_saved_actor.gender == 'M' first_saved_actor.remove() assert Actor.query.get(1) is None
from app.models import Movie, Genre, Actor, Director, Producer from dataset import movies, genres, actors, directors, producers for genre in genres: new_genre = Genre(name=genre) new_genre.save() for actor in actors: new_actor = Actor(name=actor['name'], birthdate=actor['birthdate'], years_active=actor['years_active'], nationality=actor['nationality'], imageField=actor['imageField'], twitterAccount=actor['twitterAccount'], instagramAccount=actor['instagramAccount']) new_actor.save() for director in directors: new_director = Director(name=director['name'], birthdate=director['birthdate'], website=director['website'], imageField=director['imageField'], twitterAccount=director['twitterAccount'], instagramAccount=director['instagramAccount']) new_director.save() for producer in producers: new_producer = Producer(name=producer['name'], city=producer['city'], country=producer['country'], website=producer['website'],
def test_actor(self): actor = Actor(name='ACTOR', age=10, gender='F') actor.save() return actor