def test_repository_can_add_a_genre(session_factory): repo = SqlAlchemyRepository(session_factory) genre = Genre('Motoring') genre.tagged_movies = None 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) == 18 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 == 'Crime'][0] genre_four = [genre for genre in genres if genre.genre_name == 'Horror'][0] assert genre_one is not None assert genre_two is not None assert genre_three is not None assert genre_four is not None