(self)
| 123 | eq_(u.database, "path/with/slashes") |
| 124 | |
| 125 | def test_rfc1738_password(self): |
| 126 | u = url.make_url("dbtype://user:pass word + other%3Awords@host/dbname") |
| 127 | eq_(u.password, "pass word + other:words") |
| 128 | eq_(str(u), "dbtype://user:***@host/dbname") |
| 129 | eq_( |
| 130 | u.render_as_string(hide_password=False), |
| 131 | "dbtype://user:pass word + other%3Awords@host/dbname", |
| 132 | ) |
| 133 | |
| 134 | u = url.make_url( |
| 135 | "dbtype://username:apples%2Foranges@hostspec/database" |
| 136 | ) |
| 137 | eq_(u.password, "apples/oranges") |
| 138 | eq_(str(u), "dbtype://username:***@hostspec/database") |
| 139 | eq_( |
| 140 | u.render_as_string(hide_password=False), |
| 141 | "dbtype://username:apples%2Foranges@hostspec/database", |
| 142 | ) |
| 143 | |
| 144 | u = url.make_url( |
| 145 | "dbtype://username:apples%40oranges%40%40@hostspec/database" |
| 146 | ) |
| 147 | eq_(u.password, "apples@oranges@@") |
| 148 | eq_(str(u), "dbtype://username:***@hostspec/database") |
| 149 | eq_( |
| 150 | u.render_as_string(hide_password=False), |
| 151 | "dbtype://username:apples%40oranges%40%40@hostspec/database", |
| 152 | ) |
| 153 | |
| 154 | u = url.make_url("dbtype://username%40:@hostspec/database") |
| 155 | eq_(u.password, "") |
| 156 | eq_(u.username, "username@") |
| 157 | eq_( |
| 158 | # Do not reveal an empty password |
| 159 | str(u), |
| 160 | "dbtype://username%40:***@hostspec/database", |
| 161 | ) |
| 162 | eq_( |
| 163 | u.render_as_string(hide_password=False), |
| 164 | "dbtype://username%40:@hostspec/database", |
| 165 | ) |
| 166 | |
| 167 | u = url.make_url("dbtype://username:pass%2Fword@hostspec/database") |
| 168 | eq_(u.password, "pass/word") |
| 169 | eq_(str(u), "dbtype://username:***@hostspec/database") |
| 170 | eq_( |
| 171 | u.render_as_string(hide_password=False), |
| 172 | "dbtype://username:pass%2Fword@hostspec/database", |
| 173 | ) |
| 174 | |
| 175 | def test_password_custom_obj(self): |
| 176 | class SecurePassword(str): |
nothing calls this directly
no test coverage detected