mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-06 16:31:38 +00:00
created separate test for invalid no-proxy values
This commit is contained in:
parent
959222df7e
commit
82ba7c8b52
@ -123,11 +123,7 @@ class TestHttpProxyMiddleware(TestCase):
|
||||
|
||||
def test_no_proxy(self):
|
||||
os.environ['http_proxy'] = 'https://proxy.for.http:3128'
|
||||
os.environ['no_proxy'] = '/var/run/docker.sock'
|
||||
mw = HttpProxyMiddleware()
|
||||
# '/var/run/docker.sock' may be used by the user for
|
||||
# no_proxy value but is not parseable and should be skipped
|
||||
assert 'no' not in mw.proxies
|
||||
|
||||
os.environ['no_proxy'] = '*'
|
||||
req = Request('http://noproxy.com')
|
||||
@ -149,3 +145,10 @@ class TestHttpProxyMiddleware(TestCase):
|
||||
req = Request('http://noproxy.com', meta={'proxy': 'http://proxy.com'})
|
||||
assert mw.process_request(req, spider) is None
|
||||
self.assertEqual(req.meta, {'proxy': 'http://proxy.com'})
|
||||
|
||||
def test_no_proxy_invalid_values(self):
|
||||
os.environ['no_proxy'] = '/var/run/docker.sock'
|
||||
mw = HttpProxyMiddleware()
|
||||
# '/var/run/docker.sock' may be used by the user for
|
||||
# no_proxy value but is not parseable and should be skipped
|
||||
assert 'no' not in mw.proxies
|
||||
|
Loading…
x
Reference in New Issue
Block a user