This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new d603e6cf688 fix: add __call__ to MockOptional for WTForms validator 
compatibility (#63823)
d603e6cf688 is described below

commit d603e6cf6882895c74fb403150eec18ef7575d85
Author: Yoann <[email protected]>
AuthorDate: Sun Mar 22 05:28:49 2026 -0700

    fix: add __call__ to MockOptional for WTForms validator compatibility 
(#63823)
    
    Closes: #63803
---
 .../core_api/services/ui/connections.py            |  3 ++
 .../core_api/services/ui/test_connections.py       | 32 ++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py 
b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py
index 4568eb07278..96480555c40 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/services/ui/connections.py
@@ -48,6 +48,9 @@ class HookMetaService:
         ):
             pass
 
+        def __call__(self, form, field):
+            pass
+
     class MockEnum:
         """Mock for wtforms.validators.Optional."""
 
diff --git 
a/airflow-core/tests/unit/api_fastapi/core_api/services/ui/test_connections.py 
b/airflow-core/tests/unit/api_fastapi/core_api/services/ui/test_connections.py
new file mode 100644
index 00000000000..e6ed84778d3
--- /dev/null
+++ 
b/airflow-core/tests/unit/api_fastapi/core_api/services/ui/test_connections.py
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from airflow.api_fastapi.core_api.services.ui.connections import 
HookMetaService
+
+
+class TestMockOptional:
+    def test_mock_optional_is_callable(self):
+        """MockOptional instances must be callable to satisfy WTForms 
validator checks."""
+        validator = HookMetaService.MockOptional()
+        assert callable(validator)
+
+    def test_mock_optional_call_is_noop(self):
+        """Calling MockOptional should be a no-op (returns None)."""
+        validator = HookMetaService.MockOptional()
+        result = validator(None, None)
+        assert result is None

Reply via email to