mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			32 lines
		
	
	
		
			904 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			904 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from metadata.utils.logger import redacted_config
 | |
| 
 | |
| 
 | |
| def test_safe_config_logger():
 | |
|     example_obj = {
 | |
|         "serviceConnection": "some_value",
 | |
|         "securityConfig": "another_value",
 | |
|         "nested": {
 | |
|             "serviceConnection": "another_value",
 | |
|             "list": [
 | |
|                 {"serviceConnection": "value_in_list"},
 | |
|                 {"otherField": "other_value"},
 | |
|                 {"securityConfig": "security_value"},
 | |
|             ],
 | |
|         },
 | |
|     }
 | |
| 
 | |
|     result = redacted_config(example_obj)
 | |
|     expected = {
 | |
|         "serviceConnection": "REDACTED",
 | |
|         "securityConfig": "REDACTED",
 | |
|         "nested": {
 | |
|             "serviceConnection": "REDACTED",
 | |
|             "list": [
 | |
|                 {"serviceConnection": "REDACTED"},
 | |
|                 {"otherField": "other_value"},
 | |
|                 {"securityConfig": "REDACTED"},
 | |
|             ],
 | |
|         },
 | |
|     }
 | |
|     assert result == expected
 | 
