@@ -849,13 +849,70 @@ def test_remove_empty_password_keeps_host_intact(self):
849849 ("//user:pass@[2001:db8::1]:0080/repo" , "//*****:*****@[2001:db8::1]:0080/repo" ),
850850 ("https://user:p@ss@example.com/repo" , "https://*****:*****@example.com/repo" ),
851851 ("https://user:@example.com/repo" , "https://*****:*****@example.com/repo" ),
852+ ("https://user:p=ass@example.com/repo" , "https://*****:*****@example.com/repo" ),
852853 ("https://@example.com/repo" , "https://*****@example.com/repo" ),
853854 ("https://example.com/repo@name?q=a@b#c@d" , "https://example.com/repo@name?q=a@b#c@d" ),
854855 )
855856 @ddt .unpack
856857 def test_remove_password_preserves_url_components (self , url , expected ):
857858 assert remove_password_if_present ([url ]) == [expected ]
858859
860+ @ddt .data (
861+ (
862+ ["-c" , "http.proxy=http://user:pass@proxy.example.com:3128" ],
863+ ["-c" , "http.proxy=http://*****:*****@proxy.example.com:3128" ],
864+ ),
865+ (
866+ ["-c" , "remote.origin.url=https://user:pass@example.com/repo" ],
867+ ["-c" , "remote.origin.url=https://*****:*****@example.com/repo" ],
868+ ),
869+ (
870+ ["--config=http.proxy=http://user:pass@proxy.example.com:3128" ],
871+ ["--config=http.proxy=http://*****:*****@proxy.example.com:3128" ],
872+ ),
873+ (
874+ ["--config=url.https://user:pass@example.com/.insteadOf=https://example.com/" ],
875+ ["--config=url.https://*****:*****@example.com/.insteadOf=https://example.com/" ],
876+ ),
877+ (
878+ ["--config=http.extraHeader=Authorization: Bearer pass" ],
879+ ["--config=http.extraHeader=Authorization: *****" ],
880+ ),
881+ (
882+ ["--config=http.https://alice@host.proxy=http://bob:token@proxy" ],
883+ ["--config=http.https://*****@host.proxy=http://*****:*****@proxy" ],
884+ ),
885+ (
886+ ["-c" , "http.https://alice@host.proxy=http://bob:token@proxy" ],
887+ ["-c" , "http.https://*****@host.proxy=http://*****:*****@proxy" ],
888+ ),
889+ (
890+ ["-chttp.https://alice@host.proxy=http://bob:token@proxy" ],
891+ ["-chttp.https://*****@host.proxy=http://*****:*****@proxy" ],
892+ ),
893+ (
894+ ["-curl.https://user:token@host/.insteadOf=https://old/" ],
895+ ["-curl.https://*****:*****@host/.insteadOf=https://old/" ],
896+ ),
897+ (
898+ ["-chttp.proxy=http://bob:token@proxy" ],
899+ ["-chttp.proxy=http://*****:*****@proxy" ],
900+ ),
901+ (
902+ ["--config=http.https://alice:token@host/.extraHeader=Authorization: Bearer pass" ],
903+ ["--config=http.https://*****:*****@host/.extraHeader=Authorization: *****" ],
904+ ),
905+ (
906+ ["-chttp.extraHeader=Authorization: Bearer pass" ],
907+ ["-chttp.extraHeader=Authorization: *****" ],
908+ ),
909+ (["-c" , "user.name=pass" ], ["-c" , "user.name=pass" ]),
910+ (["-cuser.name=pass" ], ["-cuser.name=pass" ]),
911+ )
912+ @ddt .unpack
913+ def test_remove_password_from_config_values (self , cmdline , expected ):
914+ assert remove_password_if_present (cmdline ) == expected
915+
859916
860917def test_mode_str_to_int_accepts_bytes ():
861918 assert mode_str_to_int ("100644" ) == 0o100644
0 commit comments