示例#1
0
    def test_get_list_pagination(self):
        """"
        Method for testing get list of all films with pagination
        :return: OK or Error
        """

        db.session.add(self.test_category)
        db.session.commit()

        self.test_film_controller.test_film.test_category_id = \
            self.test_category.id

        self.test_film_controller.create()

        result = TestFilmController.get_list_pagination(
            start=0,
            limit=10,
            film_name=self.test_film_controller.test_film.name,
            category_id=self.test_category.id)

        self.assertEqual(Status.status_successfully_processed().__dict__,
                         result['status'])
        self.assertEqual(int, type(result['total']))
        self.assertEqual(list, type(result['data']))
        self.assertIn(str(self.test_film_controller.test_film.id),
                      [d['id'] for d in result['data']])
示例#2
0
    def test_activate(self):
        """
        Method for testing categories activate
        :return: OK OR ERROR
        """

        self.test_category_controller.create()
        result = self.test_category_controller.activate()

        self.assertEqual(Status.status_successfully_processed().__dict__,
                         result)

        self.assertEqual(TestCategory.STATUSES['active'],
                         self.test_category_controller.test_category.status)
示例#3
0
    def test_get_list_pagination(self):
        """"
        Method for testing get list of all categories with pagination
        :return: OK or Error
        """

        self.test_category_controller.create()

        result = TestCategoryController.get_list_pagination(
            start=0,
            limit=10,
            name=self.test_category_controller.test_category.name)
        self.assertEqual(Status.status_successfully_processed().__dict__,
                         result['status'])
        self.assertEqual(int, type(result['total']))
        self.assertEqual(list, type(result['data']))
        self.assertIn(str(self.test_category_controller.test_category.id),
                      [d['id'] for d in result['data']])