Ensure b'test' formats as the byte string "test" rather than the unicode string "b'test'" in Python 3.
(self)
| 570 | assert p.headers["Authorization"] == _basic_auth_str(username, password) |
| 571 | |
| 572 | def test_basicauth_encodes_byte_strings(self): |
| 573 | """Ensure b'test' formats as the byte string "test" rather |
| 574 | than the unicode string "b'test'" in Python 3. |
| 575 | """ |
| 576 | auth = (b"\xc5\xafsername", b"test\xc6\xb6") |
| 577 | r = requests.Request("GET", "http://localhost", auth=auth) |
| 578 | p = r.prepare() |
| 579 | |
| 580 | assert p.headers["Authorization"] == "Basic xa9zZXJuYW1lOnRlc3TGtg==" |
| 581 | |
| 582 | @pytest.mark.parametrize( |
| 583 | "url, exception", |