2
0

Add check for url with broken password

replace broken password in parseConfigError message
This commit is contained in:
ip.novikov
2020-12-05 15:28:01 +03:00
committed by ip.novikov
parent 3742d6209e
commit a581247a12
2 changed files with 12 additions and 0 deletions
+10
View File
@@ -33,6 +33,16 @@ func TestConfigError(t *testing.T) {
err: pgconn.NewParseConfigError("postgresql://foo::pasword@host:1:", "msg", nil),
expectedMsg: "cannot parse `postgresql://foo:xxxxx@host:1:`: msg",
},
{
name: "weird url with slash in password",
err: pgconn.NewParseConfigError("postgres://user:pass/word@host:5432/db_name", "msg", nil),
expectedMsg: "cannot parse `postgres://user:xxxxxx@host:5432/db_name`: msg",
},
{
name: "url without password",
err: pgconn.NewParseConfigError("postgresql://other@host/db", "msg", nil),
expectedMsg: "cannot parse `postgresql://other@host/db`: msg",
},
}
for _, tt := range tests {
tt := tt