コード例 #1
0
ファイル: test_orm.py プロジェクト: NeoXB/CS235Flix-SQL
def make_movie():
    movie = Movie("WOW", 2020)
    movie.rank = 1001
    movie.description = "This is the best movie in the world."
    movie.director = Director("Barraza")
    movie.runtime_minutes = 100
    movie.rating = 100
    movie.votes = 100
    movie.revenue = 100
    movie.metascore = 100
    return movie
コード例 #2
0
ファイル: services.py プロジェクト: NeoXB/CS235Flix-SQL
def dict_to_movie(dict):
    movie = Movie(dict.title, dict.release_year)
    movie.rank = dict.rank
    movie.description = dict.description
    movie.director = dict_to_director(dict.director)
    movie.actors = dict_to_actors(dict.actors)
    movie.genres = dict_to_genres(dict.genres)
    movie.runtime_minutes = dict.runtime_minutes
    movie.rating = dict.rating
    movie.votes = dict.votes
    movie.revenue = dict.revenue
    movie.metascore = dict.metascore
    return movie
コード例 #3
0
def test_repo_can_add_movie(session_factory):
    repo = SqlAlchemyRepository(session_factory)

    number_of_movies = repo.get_number_of_movies()

    new_movie_id = number_of_movies + 1

    movie = Movie("WOW", 2020)
    movie.rank = new_movie_id
    movie.description = "This is the best movie in the world."
    movie.director = Director("Barraza")
    movie.runtime_minutes = 100
    movie.rating = 100
    movie.votes = 100
    movie.revenue = 100
    movie.metascore = 100
    repo.add_movie(movie)

    assert repo.get_movie(new_movie_id) == movie