(self)
| 1554 | |
| 1555 | @unittest.skipUnless(sys.platform == 'darwin', "only relevant for OSX") |
| 1556 | def test_osx_proxy_bypass(self): |
| 1557 | bypass = { |
| 1558 | 'exclude_simple': False, |
| 1559 | 'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.10', |
| 1560 | '10.0/16'] |
| 1561 | } |
| 1562 | # Check hosts that should trigger the proxy bypass |
| 1563 | for host in ('foo.bar', 'www.bar.com', '127.0.0.1', '10.10.0.1', |
| 1564 | '10.0.0.1'): |
| 1565 | self.assertTrue(_proxy_bypass_macosx_sysconf(host, bypass), |
| 1566 | 'expected bypass of %s to be True' % host) |
| 1567 | # Check hosts that should not trigger the proxy bypass |
| 1568 | for host in ('abc.foo.bar', 'bar.com', '127.0.0.2', '10.11.0.1', |
| 1569 | 'notinbypass'): |
| 1570 | self.assertFalse(_proxy_bypass_macosx_sysconf(host, bypass), |
| 1571 | 'expected bypass of %s to be False' % host) |
| 1572 | |
| 1573 | # Check the exclude_simple flag |
| 1574 | bypass = {'exclude_simple': True, 'exceptions': []} |
| 1575 | self.assertTrue(_proxy_bypass_macosx_sysconf('test', bypass)) |
| 1576 | |
| 1577 | # Check that invalid prefix lengths are ignored |
| 1578 | bypass = { |
| 1579 | 'exclude_simple': False, |
| 1580 | 'exceptions': [ '10.0.0.0/40', '172.19.10.0/24' ] |
| 1581 | } |
| 1582 | host = '172.19.10.5' |
| 1583 | self.assertTrue(_proxy_bypass_macosx_sysconf(host, bypass), |
| 1584 | 'expected bypass of %s to be True' % host) |
| 1585 | host = '10.0.1.5' |
| 1586 | self.assertFalse(_proxy_bypass_macosx_sysconf(host, bypass), |
| 1587 | 'expected bypass of %s to be False' % host) |
| 1588 | |
| 1589 | def check_basic_auth(self, headers, realm): |
| 1590 | with self.subTest(realm=realm, headers=headers): |
nothing calls this directly
no test coverage detected