Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 5f905e5

Browse files
committed
Add http11 init tests for proxy
1 parent f49b601 commit 5f905e5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/test_http11.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,53 @@ def test_initialization_no_port(self):
4343
assert c.host == 'httpbin.org'
4444
assert c.port == 80
4545
assert not c.secure
46+
assert not c.proxy_host
47+
assert not c.proxy_port
4648

4749
def test_initialization_inline_port(self):
4850
c = HTTP11Connection('httpbin.org:443')
4951

5052
assert c.host == 'httpbin.org'
5153
assert c.port == 443
5254
assert c.secure
55+
assert not c.proxy_host
56+
assert not c.proxy_port
5357

5458
def test_initialization_separate_port(self):
5559
c = HTTP11Connection('localhost', 8080)
5660

5761
assert c.host == 'localhost'
5862
assert c.port == 8080
5963
assert not c.secure
64+
assert not c.proxy_host
65+
assert not c.proxy_port
6066

6167
def test_can_override_security(self):
6268
c = HTTP11Connection('localhost', 443, secure=False)
6369

6470
assert c.host == 'localhost'
6571
assert c.port == 443
6672
assert not c.secure
73+
assert not c.proxy_host
74+
assert not c.proxy_port
75+
76+
def test_initialization_proxy(self):
77+
c = HTTP11Connection('httpbin.org', proxy='localhost')
78+
79+
assert c.host == 'httpbin.org'
80+
assert c.port == 80
81+
assert not c.secure
82+
assert c.proxy_host == 'localhost'
83+
assert c.proxy_port == 8080
84+
85+
def test_initialization_proxy_with_port(self):
86+
c = HTTP11Connection('httpbin.org', proxy='localhost:8443')
87+
88+
assert c.host == 'httpbin.org'
89+
assert c.port == 80
90+
assert not c.secure
91+
assert c.proxy_host == 'localhost'
92+
assert c.proxy_port == 8443
6793

6894
def test_basic_request(self):
6995
c = HTTP11Connection('httpbin.org')

0 commit comments

Comments
 (0)