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]
def test_show_live_reviews(simulator): user1 = User('user1_username', 'user1_password') user1_first_review = Review(user1, Movie("Star War", 2017, 1), "This is user1's first review for Star War", 9, date.fromisoformat('2020-09-21')) user1_second_review = Review(user1, Movie("Star War", 2017, 2), "This is user1's second review for Star War", 9, date.fromisoformat('2020-09-21')) user1_another_review = Review(user1, Movie("Hunger Game", 2016, 3), "This is user1's review for Hunger game", 8, date.fromisoformat('2020-09-21')) user1.add_review(user1_first_review) user1.add_review(user1_second_review) user1.add_review(user1_another_review) user2 = User('user2_username', 'user2_password') user2_first_review = Review(user2, Movie("Star War", 2017, 4), "This is user2's first review for Star War", 6, date.fromisoformat('2020-09-21')) user2.add_review(user2_first_review) simulator.add_user(user1) simulator.add_user(user2) simulator.retrieve_review() assert simulator.show_live_reviews() == "Live Reviews for <Movie Star War, 2017>:\n<User user1_username> ---> This is user1's first review " \ "for Star War\n" + "<User user1_username> ---> This is user1's second review for Star War\n" \ + "<User user2_username> ---> This is user2's first review for Star War\n"
def test_reper(simulator): user1 = User('user1_username', 'user1_password') user1_first_review = Review(user1, Movie("Star War", 2017, 2), "This is user1's first review for Star War", 9, date.fromisoformat('2020-09-21')) user1_second_review = Review(user1, Movie("Star War", 2017, 1), "This is user1's second review for Star War", 9, date.fromisoformat('2020-09-21')) user1_another_review = Review(user1, Movie("Hunger Game", 2016, 3), "This is user1's review for Hunger game", 8, date.fromisoformat('2020-09-21')) user1.add_review(user1_first_review) user1.add_review(user1_second_review) user1.add_review(user1_another_review) user2 = User('user2_username', 'user2_password') user2_first_review = Review(user2, Movie("Star War", 2017, 1), "This is user2's first review for Star War", 6, date.fromisoformat('2020-09-21')) user2.add_review(user2_first_review) simulator.add_user(user1) simulator.add_user(user2) simulator.retrieve_review() assert repr( simulator ) == "Movie Watching Simulation - Star War : 2017\nNumber of users watching: 2\nNumber of reviews received: 3"
def test_adding_reviews(simulator): user1 = User('user1_username', 'user1_password') user1_first_review = Review(user1, Movie("Star War", 2017, 1), "This is user1's first review for Star War", 9, date.fromisoformat('2020-09-21')) user1_second_review = Review(user1, Movie("Star War", 2017, 1), "This is user1's second review for Star War", 9, date.fromisoformat('2020-09-21')) user1_another_review = Review(user1, Movie("Hunger Game", 2016, 2), "This is user1's review for Hunger game", 8, date.fromisoformat('2020-09-21')) user1.add_review(user1_first_review) user1.add_review(user1_second_review) user1.add_review(user1_another_review) user2 = User('user2_username', 'user2_password') user2_first_review = Review(user2, Movie("Star War", 2017, 1), "This is user2's first review for Star War", 6, date.fromisoformat('2020-09-21')) user2.add_review(user2_first_review) simulator.add_user(user1) simulator.add_user(user2) simulator.retrieve_review() assert simulator.num_of_reviews == 3