(self)
| 173 | ) |
| 174 | |
| 175 | def test_password_custom_obj(self): |
| 176 | class SecurePassword(str): |
| 177 | def __init__(self, value): |
| 178 | self.value = value |
| 179 | |
| 180 | def __str__(self): |
| 181 | return self.value |
| 182 | |
| 183 | sp = SecurePassword("secured_password") |
| 184 | u = url.URL.create( |
| 185 | "dbtype", username="x", password=sp, host="localhost" |
| 186 | ) |
| 187 | |
| 188 | eq_(u.password, "secured_password") |
| 189 | eq_( |
| 190 | u.render_as_string(hide_password=False), |
| 191 | "dbtype://x:secured_password@localhost", |
| 192 | ) |
| 193 | |
| 194 | # test in-place modification |
| 195 | sp.value = "new_secured_password" |
| 196 | eq_(u.password, sp) |
| 197 | eq_( |
| 198 | u.render_as_string(hide_password=False), |
| 199 | "dbtype://x:new_secured_password@localhost", |
| 200 | ) |
| 201 | |
| 202 | u = u.set(password="hi") |
| 203 | |
| 204 | eq_(u.password, "hi") |
| 205 | eq_(u.render_as_string(hide_password=False), "dbtype://x:hi@localhost") |
| 206 | |
| 207 | u = u._replace(password=None) |
| 208 | |
| 209 | is_(u.password, None) |
| 210 | eq_(u.render_as_string(hide_password=False), "dbtype://x@localhost") |
| 211 | |
| 212 | def test_query_string(self): |
| 213 | u = url.make_url("dialect://user:pass@host/db?arg1=param1&arg2=param2") |
nothing calls this directly
no test coverage detected