def test_repository_does_not_add_a_review_without_a_movie_properly_attached(in_memory_repo):
    user = User('spooky', 'Spookier9')
    in_memory_repo.add_user(user)
    user = in_memory_repo.get_user('Spooky')
    movie = in_memory_repo.get_movie(2)
    review = Review(None, movie, "Action packed!")

    user.add_review(review)

    with pytest.raises(RepositoryException):
        # Exception expected because the Article doesn't refer to the Comment.
        in_memory_repo.add_review(review)
def test_repository_does_not_add_a_review_without_a_movie_properly_attached(
        in_memory_repo):
    user = User('wpking', 'Alphadog123')
    in_memory_repo.add_user(user)
    user = in_memory_repo.get_user('wpking')
    movie = in_memory_repo.get_movie(2)
    review = Review(None, movie, "The movie was quite average")

    user.add_review(review)

    with pytest.raises(RepositoryException):
        # Exception expected because the Article doesn't refer to the Comment.
        in_memory_repo.add_review(review)
def test_repository_does_not_add_a_review_without_a_movie_properly_attached(
        in_memory_repo):
    user = User('Nina', '123456789')
    in_memory_repo.add_user(user)
    user = in_memory_repo.get_user('Nina')
    movie = in_memory_repo.get_movie(2)
    review = Review(None, movie, "i like this movie :)")

    user.add_review(review)

    with pytest.raises(RepositoryException):
        # Exception expected because the Article doesn't refer to the Comment.
        in_memory_repo.add_review(review)