def test_repository_does_not_retrieve_a_non_existent_director(): mem_repo = MemoryRepository() up_movie = Movie("Up", 2009, 1) inside_out_movie = Movie("Inside Out", 2015, 2) dolittle_movie = Movie("Dolittle", 2019, 3) up_movie.director = Director("Pete Docter") inside_out_movie.director = Director("Pete Docter") dolittle_movie.director = Director("Stephen Gaghan") mem_repo.add_movie(up_movie) mem_repo.add_movie(inside_out_movie) mem_repo.add_movie(dolittle_movie) movies_by_director = mem_repo.get_movies_by_director( Director("Sergio Pablos")) assert len(movies_by_director) == 0 assert movies_by_director == []
def test_repository_can_get_movies_by_director(): mem_repo = MemoryRepository() up_movie = Movie("Up", 2009, 1) inside_out_movie = Movie("Inside Out", 2015, 2) dolittle_movie = Movie("Dolittle", 2019, 3) up_movie.director = Director("Pete Docter") inside_out_movie.director = Director("Pete Docter") dolittle_movie.director = Director("Stephen Gaghan") mem_repo.add_movie(up_movie) mem_repo.add_movie(inside_out_movie) mem_repo.add_movie(dolittle_movie) movies_by_director = mem_repo.get_movies_by_director( Director("Pete Docter")) assert len(movies_by_director) == 2 assert movies_by_director == [inside_out_movie, up_movie]