Beispiel #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']])
Beispiel #2
0
    def test_create(self):
        """
        Method for testing creation of categories
        :return: OK or ERROR
        """

        status_insert = self.test_category_controller.create()

        self.assertEqual(Status.status_successfully_inserted().__dict__,
                         status_insert)

        self.assertIsNotNone(self.test_category_controller.test_category.id)
Beispiel #3
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)
Beispiel #4
0
    def test_create(self):
        """
        Method for testing creation of film
        :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

        status_insert = self.test_film_controller.create()

        self.assertEqual(Status.status_successfully_inserted().__dict__,
                         status_insert)

        self.assertIsNotNone(self.test_film_controller.test_film.id)
Beispiel #5
0
    def test_alter(self):
        """
        Method for testing categories updates
        :return: OK or ERROR
        """

        self.test_category_controller.create()

        name = self.faker.name()
        self.test_category_controller.test_category.name = name

        result = self.test_category_controller.alter()

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

        self.assertEqual(name,
                         self.test_category_controller.test_category.name)
Beispiel #6
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']])