def test_repository_can_add_a_genre(session_factory): repo = SqlAlchemyRepository(session_factory) genre = Genre('WOW') repo.add_genre(genre) assert genre in repo.get_genres()
def test_repository_can_retrieve_genres(session_factory): repo = SqlAlchemyRepository(session_factory) genres = repo.get_genres() assert len(genres) == 10 genre_one = [genre for genre in genres if genre.genre_name == 'Action'][0] genre_two = [genre for genre in genres if genre.genre_name == 'Adventure'][0] genre_three = [genre for genre in genres if genre.genre_name == 'Sci-Fi'][0] genre_four = [genre for genre in genres if genre.genre_name == 'Mystery'][0] assert genre_one.number_of_genre_movies == 53 assert genre_two.number_of_genre_movies == 2 assert genre_three.number_of_genre_movies == 64 assert genre_four.number_of_genre_movies == 1