potiuk commented on code in PR #36692:
URL: https://github.com/apache/airflow/pull/36692#discussion_r1460298660


##########
tests/utils/log/test_secrets_masker.py:
##########
@@ -340,6 +340,22 @@ def test_redact_state_enum(self, logger, caplog, state, 
expected):
         assert caplog.text == f"INFO State: {expected}\n"
         assert "TypeError" not in caplog.text
 
+    def test_masking_quoted_strings_in_connection(self, logger, caplog):
+        secrets_masker = [fltr for fltr in logger.filters if isinstance(fltr, 
SecretsMasker)][0]
+        with patch("airflow.utils.log.secrets_masker._secrets_masker", 
return_value=secrets_masker):
+            test_conn_attributes = dict(
+                conn_type="scheme",
+                host="host/location",
+                schema="schema",
+                login="user",
+                password="should_be_hidden!",
+                port=1234,
+                extra=None,
+            )
+            conn = Connection(**test_conn_attributes)
+            logger.info(conn.get_uri())
+            assert caplog.text.find("should_be_hidden") == -1

Review Comment:
   NIT: Rather use `"should_be_hidden" in caplog.text` - this way assertion 
when failing will show the content of caplog.text



-- 
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