def test_repository_can_add_a_genre(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    genre = Genre('Motoring')
    repo.add_genre(genre)

    assert genre in repo.get_genre()
def test_repository_can_retrieve_genres(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    genres = repo.get_genre()

    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_movie == 2
    assert genre_two.number_of_genre_movie == 3
    assert genre_three.number_of_genre_movie == 2
    assert genre_four.number_of_genre_movie == 1