예제 #1
0
def test_movie_detail(repo):
    movieId = 1
    movieTitle = 'Guardians of the Galaxy'
    movie = movie_services.get_movie(movieId, repo)

    assert movie.id == movieId
    assert movie.title == movieTitle
예제 #2
0
def test_add_review(repo):
    username = '******'
    password = '******'
    auth_services.register(username, password, repo)

    movieId = 1
    content = 'first review'
    movie_services.add_review(content, username, movieId, repo)

    movie = movie_services.get_movie(movieId, repo)

    assert len(movie.reviews) == 1
    assert movie.reviews[0].content == content
예제 #3
0
def test_add_to_watchlist(repo):
    username = '******'
    password = '******'
    auth_services.register(username, password, repo)

    movieId = 1

    movie_services.add_to_watchlist(username, movieId, repo)

    user = auth_services.login(username, password, repo)
    movie = movie_services.get_movie(movieId, repo)

    assert movie in user.watchList
    assert len(user.watchList) == 1
예제 #4
0
파일: movie.py 프로젝트: shze139/CS235A3
def detail(id):
    reviewForm = ReviewForm(request.form)
    movie = None
    hasWatch = False
    status_code = 200
    try:
        movie = services.get_movie(id, repo)
        username = session.get('username')
        hasWatch = services.has_watch(movie, username, repo)
    except services.MovieNotFoundException:
        status_code = 404
    return render_template('movie.html',
                           movie=movie,
                           reviewForm=reviewForm,
                           hasWatch=hasWatch), status_code
예제 #5
0
def test_movie_not_found(repo):
    movieId = 9999

    with pytest.raises(movie_services.MovieNotFoundException):
        movie_services.get_movie(movieId, repo)