def test_repository_does_not_retrieve_a_non_existent_title(): mem_repo = MemoryRepository() up_movie = Movie("Up", 2009, 1) klaus_movie = Movie("Klaus", 2019, 2) dolittle_movie = Movie("Dolittle", 2019, 3) mem_repo.add_movie(up_movie) mem_repo.add_movie(klaus_movie) mem_repo.add_movie(dolittle_movie) movies_by_title = mem_repo.get_movies_by_title(["Up", "Klaus", "Frozen"]) assert len(movies_by_title) == 2 assert movies_by_title == [up_movie, klaus_movie]
def test_repository_can_get_movies_by_title(): mem_repo = MemoryRepository() up_movie = Movie("Up", 2009, 1) klaus_movie = Movie("Klaus", 2019, 2) dolittle_movie = Movie("Dolittle", 2019, 3) mem_repo.add_movie(up_movie) mem_repo.add_movie(klaus_movie) mem_repo.add_movie(dolittle_movie) # ["Dolittle", "Klaus", "Up"] movies_by_title = mem_repo.get_movies_by_title(["Up", "Klaus", "Dolittle"]) assert len(movies_by_title) == 3 assert movies_by_title == [up_movie, klaus_movie, dolittle_movie]