Пример #1
0
    def test_filterRequest_getMoviesEmptyParams_AllMoviesDate(self):
        # from queries.movie_query import MovieQuery
        # from models import Category,Movie
        params = {}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.order_by("-created_date")
        self.assertEquals(list(movies), list(result))
Пример #2
0
    def test_filterRequest_getMoviesWrongSlugAndCorrectSort_MoviesNotExists(self):
        params = {'slug': 'tiller', 'sort': 'Alphabet'}
        movies = MovieQuery.filterRequest(params)

        result = []
        self.assertEquals(list(movies), list(result))
Пример #3
0
    def test_filterRequest_getMoviesCorrectSlugAndWrongSort_MoviesKomediyaOnDate(self):
        params = {'slug': 'komediya', 'sort': 'image'}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.filter(category=Category.object.get(slug='komediya')).order_by("-created_date")
        self.assertEquals(list(movies), list(result))
Пример #4
0
    def test_filterRequest_getMoviesWrongSort_AllMoviesDate(self):
        params = {'sort': 'image'}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.order_by("-created_date")
        self.assertEquals(list(movies), list(result))
Пример #5
0
    def test_filterRequest_getMoviesWrongSearch_MoviesNotExists(self):
        params = {'search': 'kirill'}
        movies = MovieQuery.filterRequest(params)

        result = []
        self.assertEquals(list(movies), result)
Пример #6
0
    def test_filterRequest_getMoviesWrongSlug_MoviesNotExists(self):
        params = {'slug': 'tiller'}
        movies = MovieQuery.filterRequest(params)

        result = []
        self.assertEquals(movies, result)
Пример #7
0
    def test_filterRequest_getMoviesWrongPK_MoviesNotExists(self):
        params = {'pk': 1123}
        movies = MovieQuery.filterRequest(params)

        result = []
        self.assertEquals(movies, result)
Пример #8
0
    def test_filterRequest_getMoviesNoneParams_AllMoviesDate(self):
        params = None
        movie = MovieQuery.filterRequest(params)

        result = Movie.object.order_by("-created_date")
        self.assertEquals(list(movie), list(result))
Пример #9
0
    def test_filterRequest_getMoviesCorrectSearch_MovieCorrect(self):
        params = {'search': "Почему он?"}
        movie = MovieQuery.filterRequest(params)

        result = Movie.object.filter(movie_name='Почему он?')
        self.assertEquals(list(movie), list(result))
Пример #10
0
    def test_filterRequest_getMoviesCorrectSlug_MoviesDrama(self):
        params = {'slug': 'drama'}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.order_by("-created_date").filter(category=Category.object.get(slug='drama'))
        self.assertEquals(list(movies), list(result))
Пример #11
0
    def test_filterRequest_getMoviesCorrectSlugAndSort_MoviesKomediyaOnAlphabet(self):
        params = {'slug': 'komediya', 'sort': 'Alphabet'}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.filter(category=Category.object.get(slug='komediya')).order_by("movie_name")
        self.assertEquals(list(movies), list(result))
Пример #12
0
    def test_filterRequest_getMoviesPK1_MoviesCorrect(self):
        params = {'pk': 1}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.all().get(pk=1)
        self.assertEquals(movies, result)
Пример #13
0
    def test_filterRequest_getMoviesCorrectSearchAndSort_MoviesCorrect(self):
        params = {'search': "Почему он?", 'sort': 'Alphabet'}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.filter(movie_name='Почему он?').order_by("movie_name")
        self.assertEquals(list(movies), list(result))
Пример #14
0
    def test_filterRequest_getMoviesWrongSearchAndSort_MoviesNotExists(self):
        params = {'search': 'kyky', 'sort': 'image'}
        movies = MovieQuery.filterRequest(params)

        result = []
        self.assertEquals(list(movies), list(result))
Пример #15
0
    def test_filterRequest_getMoviesCorrectSlugAndNoneSort_Moviesslug(self):
        params = {'slug': 'drama', 'sort': None}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.filter(category=Category.object.get(slug='drama')).order_by("-created_date")
        self.assertEquals(list(movies), list(result))
Пример #16
0
    def test_filterRequest_getMoviesNoneSlugAndCorrectSort_AllMoviesSort(self):
        params = {'slug': None, 'sort': 'Alphabet'}
        movies = MovieQuery.filterRequest(params)

        result = Movie.object.order_by("movie_name")
        self.assertEquals(list(movies), list(result))