pierrejeambrun commented on code in PR #70583:
URL: https://github.com/apache/airflow/pull/70583#discussion_r3664636493


##########
airflow-core/tests/unit/api_fastapi/logging/test_decorators.py:
##########
@@ -122,3 +126,33 @@ def test_masks_val_alias(self):
     def test_value_without_key_is_still_masked(self):
         result = _mask_variable_fields({"value": "secretval"})
         assert result == {"value": "***"}
+
+
+class TestActionLoggingUserFields:
+    """The audit Log records the raw identifier in ``owner`` and the 
human-friendly
+    ``get_display_name()`` in ``owner_display_name``."""
+
+    def test_owner_and_display_name_use_the_matching_user_methods(self):
+        class FakeUser(BaseUser):
+            def get_id(self) -> str:
+                return "id"
+
+            def get_name(self) -> str:
+                return "jdoe"
+
+            def get_display_name(self) -> str:
+                return "Jane Doe"
+
+        request = MagicMock()
+        request.headers = {}
+        request.method = "GET"
+        request.query_params = {}
+        request.path_params = {}
+        request.body = AsyncMock(return_value=b"")
+        session = MagicMock()

Review Comment:
   I've rewritten this path to use a real Request object instead which is 
cleaner 
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to