amarlearning commented on code in PR #48791:
URL: https://github.com/apache/airflow/pull/48791#discussion_r2029032265


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_connections.py:
##########
@@ -170,6 +170,22 @@ def test_get_should_respond_200_with_extra_redacted(self, 
test_client, session):
         assert body["conn_type"] == TEST_CONN_TYPE
         assert body["extra"] == '{"password": "***"}'
 
+    @pytest.mark.enable_redact
+    def test_get_should_respond_200_with_generic_connection(self, test_client, 
session):
+        connection = Connection(
+            conn_id=TEST_CONN_ID, conn_type="generic", login="a", 
password="a", extra='{"key": "value"}'
+        )
+        session.add(connection)
+        session.commit()
+
+        response = test_client.get(f"/connections/{TEST_CONN_ID}")
+        assert response.status_code == 200
+        body = response.json()
+        assert body["connection_id"] == TEST_CONN_ID
+        assert body["conn_type"] == "generic"
+        assert body["login"] == "a"
+        assert body["extra"] == '{"key": "value"}'
+

Review Comment:
   We're covering the scenario where a user creates a generic connection with 
`login="a"`, `password="a"`, and extra as `{"key": "value"}`.
   
   Previously, without the masking fix, since "a" was a password, it also 
masked occurrences of "a" inside the "value" field in extra.
   
   
![ref](https://private-user-images.githubusercontent.com/95105677/425780781-197fd141-7a6a-4b10-8916-b96d5c1d840a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDM3ODA2MzIsIm5iZiI6MTc0Mzc4MDMzMiwicGF0aCI6Ii85NTEwNTY3Ny80MjU3ODA3ODEtMTk3ZmQxNDEtN2E2YS00YjEwLTg5MTYtYjk2ZDVjMWQ4NDBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA0MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNDA0VDE1MjUzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTczNWJlY2NiM2YwNWUwZGE0NGQ2MWIyMTA1MTY2YTM2ODAxYTM5N2FmNGNmYjM5YmYyMjY0MmVmNzhiOTA3MWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.DTVzossidwTu19uxzIVLj7ilguynUD25oPWresTwe5U)
   
   Now, with the changes made in masking logic, we are verifying here that it's 
not being masked here.
   



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