def test_repository_can_retrieve_movie_count(session_factory): repo = SqlAlchemyRepository(session_factory) number_of_movies = repo.get_number_of_movies() # Check that the query returned 177 Movies. assert number_of_movies == 100
def test_repository_can_add_movie(session_factory): repo = SqlAlchemyRepository(session_factory) number_of_movies = repo.get_number_of_movies() new_movie_id = number_of_movies + 1 movie = Movie('test movie', 2020, new_movie_id) movie.genres = None movie.actors = None repo.add_movie(movie) assert repo.get_movie(new_movie_id) == movie