Esempio n. 1
0
    def test_get_all_no_results(self):
        # arrange
        test_params = {}
        expected_films = []

        # act
        result_films = FilmDBRepo.get_all(test_params)

        # assert
        assert result_films == expected_films
Esempio n. 2
0
    def test_get_all_sort(self, films_3, films_3_core):
        # arrange
        test_params = {'sort': 'title'}
        expected_films = films_3_core
        expected_len = 3

        # act
        result_films = FilmDBRepo.get_all(test_params)

        # assert
        for i in range(expected_len):
            assert result_films[i].title == expected_films[i].title
Esempio n. 3
0
    def test_get_all_success(self, films_20):
        # arrange
        test_params = {}
        expected_films = []
        for g in films_20:
            expected_films.append(FilmDBRepo.decode_orm_film(g))
        expected_len = 10

        # act
        result_films = FilmDBRepo.get_all(test_params)

        # assert
        for i in range(expected_len):
            assert result_films[i].title == expected_films[i].title
Esempio n. 4
0
    def test_get_all_genres_sort(self, films_3):
        # arrange
        expected_genre = films_3[0].genres.all()[0].id
        test_params = {'genre': [expected_genre]}
        expected_len = 3

        # act
        result_films = FilmDBRepo.get_all(test_params)

        # assert
        for i in range(len(result_films)):
            assert expected_genre in [
                result_films[i].genres[j].id
                for j in range(len(result_films[i].genres))
            ]