def test_delete_item_integrity(self):
        """
        REST Api: Test delete item integrity
        """
        # SQLLite does not support constraints by default
        engine_type = self.appbuilder.get_session.bind.dialect.name
        if engine_type == "sqlite":
            return
        client = self.app.test_client()
        token = self.login(client, USERNAME_ADMIN, PASSWORD_ADMIN)

        with model2_data(self.appbuilder.session, 1):
            model = (
                self.appbuilder.get_session.query(Model1)
                .filter_by(field_string="test0")
                .one_or_none()
            )
            pk = model.id
            uri = f"api/v1/model1api/{pk}"

            rv = self.auth_client_delete(client, token, uri)
            self.assertEqual(rv.status_code, 422)
            model = self.db.session.query(Model1).get(pk)
            self.assertIsNotNone(model)

        REST Api: Test delete item integrity
        
tests/test_api.py