Combined tests to one tests for should_bypass_proxies method
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Kumar Varadarajulu · committed by Kumar Varadarajulu · parent f59a957 · Browse files · 1 file·+20 added−36 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+20 added−36 removed
- tests:+20 added−36 removed
Provenance
- Commit
b94decc- Tree
e43f43d- Author
Kumar Varadarajulu <kumar.varadarajulu@dealertrack.com>- Committer
Kumar Varadarajulu <kumar.varadarajulu@dealertrack.com>- Parent
f59a957
1 file changed+20 added−36 removed
modified:tests/test_utils.py+20 added-36 removed
129 unmodified lines130 def test_not_bypass(self, url):131 assert get_environ_proxies(url) != {}132 133 134-class TestShouldBypassProxies:135- """136- Tests for should_bypass_proxies function137- """138-139- @pytest.mark.parametrize(140- 'url, expected', (141- ('http://192.168.0.1:5000/', True),142- ('http://192.168.0.1/', True),143- ('http://172.16.1.1/', True),144- ('http://172.16.1.1:5000/', True),145- ('http://localhost.localdomain:5000/v1.0/', True),146- ))147- def test_should_bypass_proxies(self, url, expected, monkeypatch):148- """149- Test to check if proxy is bypassed150- """151- monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')152- monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')153- assert should_bypass_proxies(url) == expected154-155- @pytest.mark.parametrize(156- 'url, expected', (157- ('http://172.16.1.12/', False),158- ('http://172.16.1.12:5000/', False),159- ('http://google.com:5000/v1.0/', False),160- ))161- def test_should_bypass_proxies(self, url, expected, monkeypatch):162- """163- Test to check if proxy is not bypassed164- """165- monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')166- monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')167- assert should_bypass_proxies(url) == expected168-169-134 class TestIsIPv4Address:135 136 def test_valid(self):137 assert is_ipv4_address('8.8.8.8')289 unmodified lines427 ('scheme:u:p@example.com/path', 'scheme://example.com/path'),428 ))429 def test_urldefragauth(url, expected):430 assert urldefragauth(url) == expected431+432+433+@pytest.mark.parametrize(434+ 'url, expected', (435+ ('http://192.168.0.1:5000/', True),436+ ('http://192.168.0.1/', True),437+ ('http://172.16.1.1/', True),438+ ('http://172.16.1.1:5000/', True),439+ ('http://localhost.localdomain:5000/v1.0/', True),440+ ('http://172.16.1.12/', False),441+ ('http://172.16.1.12:5000/', False),442+ ('http://google.com:5000/v1.0/', False),443+ ))444+def test_should_bypass_proxies(url, expected, monkeypatch):445+ """446+ Tests for function should_bypass_proxies to check if proxy can be bypassed or not447+ """448+ monkeypatch.setenv('no_proxy', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')449+ monkeypatch.setenv('NO_PROXY', '192.168.0.0/24,127.0.0.1,localhost.localdomain,172.16.1.1')450+ assert should_bypass_proxies(url) == expected