Skip to content
Myr

unicode test for _basic_auth_str

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Dmitry Klimenko · committed by GitHub · parent 7c48212 · Browse files · 1 file+12 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−7 removed

  • tests:+12 added−7 removed

1 file+12 added−7 removed

modified:tests/test_requests.py+12 added-7 removed
459 unmodified lines
460 r = requests.put(httpbin('put'))461 assert r.status_code == 200462463 @pytest.mark.parametrize(464 'username, password, auth_str', (465 ('user', 'pass', 'Basic dXNlcjpwYXNz'),466 (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8'), 'Basic 0LjQvNGPOtC/0LDRgNC+0LvRjA=='),464 'username, password', (465 ('user', 'pass'),466 (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8')),467 ))468 def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self, httpbin, username, password, auth_str):469 auth = (username, password)470 url = httpbin('get')471 472 r = Request('GET', url, auth=auth)473 p = r.prepare()474475 assert p['Authorization'] == auth_str475 assert p['Authorization'] == _basic_auth_str(username, password)476 477 r = requests.get(url, auth=auth)478 assert r.status_code == 200479
1097 unmodified lines
1577 url = httpbin('redirect/1')1578 self._patch_adapter_gzipped_redirect(s, url)1579 s.get(url)15801581 @pytest.mark.parametrize(1582 'username, password, auth_str', (1583 ('test', 'test', 'Basic dGVzdDp0ZXN0'),1584 (u'имя'.encode('utf-8'), u'пароль'.encode('utf-8'), 'Basic 0LjQvNGPOtC/0LDRgNC+0LvRjA=='),1585 )) 1581 def test_basic_auth_str_is_always_native(self):1582 s = _basic_auth_str("test", "test")1586 def test_basic_auth_str_is_always_native(self, username, password, auth_str):1587 s = _basic_auth_str(username, password)1588 assert isinstance(s, builtin_str)1584 assert s == "Basic dGVzdDp0ZXN0"1589 assert s == auth_str15901591 def test_requests_history_is_saved(self, httpbin):1592 r = requests.get(httpbin('redirect/5'))1593 total = r.history[-1].history
557 unmodified lines