def test_watched_movies(self): user1 = User('user1', 'pw12345') movie1 = Movie("Star War", 19879, 1) movie1.set_runtime_minutes(120) user1.watch_movie(movie1) assert user1.watched_movies == [movie1] assert user1.time_spent_watching_movies_minutes == 120
def make_movie(): movie = Movie('Avengers: Endgame', 2019) movie.set_director(Director("Anthony Russo")) movie.set_description( "After Thanos, an intergalactic warlord, disintegrates half of the universe, the Avengers must reunite and assemble again to reinvigorate their trounced allies and restore balance." ) movie.set_runtime_minutes(181) return movie
def test_movie_runtime_minutes(self): movie1 = Movie("Moana", 2016, 1) movie1.set_runtime_minutes(107) assert movie1.runtime_minutes == 107 with pytest.raises(ValueError): movie1 = Movie("Kong", 2016, 3) movie1.set_runtime_minutes(-6) assert movie1.runtime_minutes == ValueError
def test_add_review(self): user1 = User('user1', 'pw12345') movie1 = Movie("Star War", 19879, 1) movie1.set_runtime_minutes(120) user1.watch_movie(movie1) review = Review(user1, movie1, "This is a great movie!", 9, date.fromisoformat('2020-03-15')) user1.add_review(review) assert user1.reviews == [review]