def test_render_url(): url_with_password = "******" assert obfuscate_url_password(url_with_password) == "http://*****:*****@example.com:3128" url_without_password = "******" assert obfuscate_url_password(url_without_password) == url_without_password
def remove_passwords(dictionary): obfuscated_dictionary = {} url_items = ["edi_host_http_proxy", "edi_host_https_proxy", "edi_host_ftp_proxy", "edi_host_socks_proxy"] for key, value in dictionary.items(): if key in url_items: obfuscated_dictionary[key] = obfuscate_url_password(value) else: obfuscated_dictionary[key] = value return obfuscated_dictionary