Skip to content

Commit 359c591

Browse files
committed
Add test_proxy_auth_works_with_mixed_case_basic_string
1 parent aba4032 commit 359c591

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/http/exceptions/test_http_proxy_auth_failed.py

+19
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,22 @@ def test_proxy_auth_works_with_valid_cred(self, mock_server_conn: mock.Mock) ->
9999
self.protocol_handler.run_once()
100100
mock_server_conn.assert_called_once()
101101
self.assertEqual(self.protocol_handler.client.has_buffer(), False)
102+
103+
@mock.patch('proxy.http.proxy.server.TcpServerConnection')
104+
def test_proxy_auth_works_with_mixed_case_basic_string(self, mock_server_conn: mock.Mock) -> None:
105+
self._conn.recv.return_value = build_http_request(
106+
b'GET', b'http://upstream.host/not-found.html',
107+
headers={
108+
b'Host': b'upstream.host',
109+
b'Proxy-Authorization': b'bAsIc dXNlcjpwYXNz',
110+
})
111+
self.mock_selector.return_value.select.side_effect = [
112+
[(selectors.SelectorKey(
113+
fileobj=self._conn,
114+
fd=self._conn.fileno,
115+
events=selectors.EVENT_READ,
116+
data=None), selectors.EVENT_READ)], ]
117+
118+
self.protocol_handler.run_once()
119+
mock_server_conn.assert_called_once()
120+
self.assertEqual(self.protocol_handler.client.has_buffer(), False)

0 commit comments

Comments
 (0)