@@ -46,10 +46,11 @@ def getheaders(self):
46
46
47
47
48
48
class DummyConnection (object ):
49
- def __init__ (self , host , port ):
49
+ def __init__ (self , host , port , secure = False ):
50
50
self .host = host
51
51
self .port = port
52
52
self .response = DummyResponse ({'content-type' : 'application/json' })
53
+ self .secure = secure
53
54
54
55
def request (self , method , path , body , headers ):
55
56
return method , path , body , headers
@@ -177,27 +178,33 @@ def test_set_request_data(args, expected):
177
178
@pytest .mark .parametrize (('args' , 'expected' ), [
178
179
(DummyNamespace ({'_url' : '' }),
179
180
{'query' : None , 'host' : 'localhost' , 'fragment' : None ,
180
- 'port' : 443 , 'netloc' : None , 'scheme' : 'https' , 'path' : '/' }),
181
+ 'port' : 443 , 'netloc' : None , 'scheme' : 'https' , 'path' : '/' ,
182
+ 'secure' : True }),
181
183
(DummyNamespace ({'_url' : 'example.com' }),
182
- {'host' : 'example.com' , 'port' : 443 , 'path' : '/' }),
184
+ {'host' : 'example.com' , 'port' : 443 , 'path' : '/' , 'secure' : True }),
183
185
(DummyNamespace ({'_url' : 'example.com/httpbin/get' }),
184
- {'host' : 'example.com' , 'port' : 443 , 'path' : '/httpbin/get' }),
186
+ {'host' : 'example.com' , 'port' : 443 , 'path' : '/httpbin/get' ,
187
+ 'secure' : True }),
185
188
(DummyNamespace ({'_url' : 'example.com:80' }),
186
- {'host' : 'example.com' , 'port' : 80 , 'path' : '/' }),
189
+ {'host' : 'example.com' , 'port' : 80 , 'path' : '/' , 'secure' : True }),
187
190
(DummyNamespace ({'_url' : 'http://example.com' }),
188
- {'host' : 'example.com' , 'port' : 80 , 'path' : '/' , 'scheme' : 'http' }),
191
+ {'host' : 'example.com' , 'port' : 80 , 'path' : '/' , 'scheme' : 'http' ,
192
+ 'secure' : False }),
189
193
(DummyNamespace ({'_url' : 'http://example.com/' }),
190
- {'host' : 'example.com' , 'port' : 80 , 'path' : '/' , 'scheme' : 'http' }),
194
+ {'host' : 'example.com' , 'port' : 80 , 'path' : '/' , 'scheme' : 'http' ,
195
+ 'secure' : False }),
191
196
(DummyNamespace ({'_url' : 'http://example.com:8080' }),
192
- {'host' : 'example.com' , 'port' : 8080 , 'path' : '/' , 'scheme' : 'http' }),
197
+ {'host' : 'example.com' , 'port' : 8080 , 'path' : '/' , 'scheme' : 'http' ,
198
+ 'secure' : False }),
193
199
(DummyNamespace ({'_url' : 'https://example.com' }),
194
- {'host' : 'example.com' , 'port' : 443 , 'path' : '/' , 'scheme' : 'https' }),
200
+ {'host' : 'example.com' , 'port' : 443 , 'path' : '/' , 'scheme' : 'https' ,
201
+ 'secure' : True }),
195
202
(DummyNamespace ({'_url' : 'https://example.com/httpbin/get' }),
196
203
{'host' : 'example.com' , 'port' : 443 , 'path' : '/httpbin/get' ,
197
- 'scheme' : 'https' }),
204
+ 'scheme' : 'https' , 'secure' : True }),
198
205
(DummyNamespace ({'_url' : 'https://example.com:8443/httpbin/get' }),
199
206
{'host' : 'example.com' , 'port' : 8443 , 'path' : '/httpbin/get' ,
200
- 'scheme' : 'https' }),
207
+ 'scheme' : 'https' , 'secure' : True }),
201
208
], ids = [
202
209
'set no url (it means default settings)' ,
203
210
'set only hostname' ,
0 commit comments