def test_repository_does_not_add_a_comment_without_a_user(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    movie = repo.get_movie(2)
    review = Review(movie, 'LOL', None, None)

    with pytest.raises(RepositoryException):
        repo.add_review(review)
def test_repository_can_add_a_review(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    user = User('thorke', '902fjsdf')
    movie = repo.get_movie(2)
    review = add_review("Highly recommended!", user, movie, 0)

    repo.add_review(review)

    assert review in repo.get_reviews()