@@ -68,3 +68,23 @@ def test_parse_expire_datetime():
68
68
69
69
def test_parse_expire_datetime_invalid ():
70
70
assert grb .parse_expire_date (prefix_discard = "artifact/expire/" , expiry_formatted = "artifact/expire/30d/" ) == {"date" :None , "time" :None , "tzoffset" :None }
71
+
72
+ def test_url_redact ():
73
+ assert grb .url_redact (url = "https://foo:pass@service/my/repo.git" , replacement = "REDACTED" ) == "https://foo:REDACTED@service/my/repo.git"
74
+ assert grb .url_redact (url = "https://foo@service/my/repo.git" , replacement = "REDACTED" ) == "https://foo@service/my/repo.git"
75
+ assert grb .url_redact (url = "https://service/my/repo.git" , replacement = "REDACTED" ) == "https://service/my/repo.git"
76
+ assert grb .url_redact (url = "https://service/my/re:po.git" , replacement = "REDACTED" ) == "https://service/my/re:po.git"
77
+ assert grb .
url_redact (
url = "https://service/my/re:[email protected] " ,
replacement = "REDACTED" )
== "https://service/my/re:[email protected] "
78
+
79
+ assert grb .url_redact (url = "ssh://foo:pass@service/my/repo.git" , replacement = "REDACTED" ) == "ssh://foo:REDACTED@service/my/repo.git"
80
+ assert grb .url_redact (url = "ssh://[foo:pass@service]/my/repo.git" , replacement = "REDACTED" ) == "ssh://[foo:REDACTED@service]/my/repo.git"
81
+ assert grb .url_redact (url = "ssh://foo@service/my/repo.git" , replacement = "REDACTED" ) == "ssh://foo@service/my/repo.git"
82
+ assert grb .url_redact (url = "ssh://service/my/repo.git" , replacement = "REDACTED" ) == "ssh://service/my/repo.git"
83
+ assert grb .url_redact (url = "ssh://service/my/re:po.git" , replacement = "REDACTED" ) == "ssh://service/my/re:po.git"
84
+ assert grb .
url_redact (
url = "ssh://service/my/re:[email protected] " ,
replacement = "REDACTED" )
== "ssh://service/my/re:[email protected] "
85
+
86
+ assert grb .url_redact (url = "foo:pass@service/my/repo.git" , replacement = "REDACTED" ) == "foo:pass@service/my/repo.git"
87
+ assert grb .url_redact (url = "foo@service/my/repo.git" , replacement = "REDACTED" ) == "foo@service/my/repo.git"
88
+ assert grb .url_redact (url = "service/my/repo.git" , replacement = "REDACTED" ) == "service/my/repo.git"
89
+ assert grb .url_redact (url = "service/my/re:po.git" , replacement = "REDACTED" ) == "service/my/re:po.git"
90
+ assert grb .
url_redact (
url = "service/my/re:[email protected] " ,
replacement = "REDACTED" )
== "service/my/re:[email protected] "
0 commit comments