Ejemplo n.º 1
0
 def test_edit_movies_tag(self, session):
     title_year = database.MovieKeyTypedDict(title='Revanche', year=2008)
     old_tags = ('green', 'yellow')
     new_tags = ('blue', 'yellow')
     database.edit_movie_tag_links(title_year, old_tags, new_tags)
     movies = database.find_movies(database.FindMovieTypedDict(title=title_year['title'],
                                                               year=[str(title_year['year'])]))
     assert set(movies[0]['tags']) == {'blue', 'yellow'}
Ejemplo n.º 2
0
 def test_missing_original_record_raises_movie_not_found(self):
     expected = ('The movie was not found in the database. '
                 'It may have been deleted by an external process.')
     old_movie = database.FindMovieTypedDict(**self.OLD_MOVIE)
     database.del_movie(old_movie)
     
     class_context = self.context_wrapper(self.OLD_MOVIE, self.NEW_MOVIE)
     with pytest.raises(database.exception.MovieDBMovieNotFound) as exc:
         with class_context():
             pass
     assert exc.type is database.exception.MovieDBMovieNotFound
     assert exc.value.args == (expected, )
Ejemplo n.º 3
0
def test_delete_movie_by_title_and_length(loaded_database):
    database.del_movie(database.FindMovieTypedDict(title='Solaris', minutes=['', '169']))
    movies = database.find_movies(dict(title='Solaris'))
    assert movies == []
Ejemplo n.º 4
0
def test_delete_movie_by_title_and_year(loaded_database):
    database.del_movie(database.FindMovieTypedDict(title='Solaris', year=['1972', '']))
    movies = database.find_movies(dict(title='Solaris'))
    assert movies == []
Ejemplo n.º 5
0
 def test_search_movie_with_minute(self):
     expected = {169}
     movies = database.find_movies(database.FindMovieTypedDict(minutes=['169']))
     minutes = {movie['minutes'] for movie in movies}
     assert minutes == expected
Ejemplo n.º 6
0
 def test_search_movie_with_range_of_minutes_2(self):
     expected = {119, 122, 169}
     criteria = database.FindMovieTypedDict(minutes=['170', '100'])
     movies = database.find_movies(criteria)
     minutes = {movie['minutes'] for movie in movies}
     assert minutes == expected
Ejemplo n.º 7
0
 def test_search_movie_year(self):
     test_year = 1996
     movies = database.find_movies(database.FindMovieTypedDict(year=[str(test_year)]))
     assert movies[0]['year'] == test_year