def test_create_item_with_enum_validation(self):
        """
        REST Api: Test validation on create item with enum
        """
        client = self.app.test_client()
        token = self.login(client, USERNAME_ADMIN, PASSWORD_ADMIN)
        item = dict(enum2="e9")
        uri = "api/v1/modelwithenumsapi/"
        rv = self.auth_client_post(client, token, uri, item)
        data = json.loads(rv.data.decode("utf-8"))
        self.assertEqual(rv.status_code, 422)
        self.assertEqual(data, {"message": {"enum2": ["Must be one of: 1, 2, 3."]}})

        REST Api: Test validation on create item with enum
        
tests/test_api.py