def test_config_default(self): patch_path = 'curryproxy.CurryProxy._process_routes' with patch(patch_path) as mocked_method: CurryProxy() default_path = '/etc/curryproxy/routes.json' mocked_method.assert_called_with(default_path)
def test_config_multiple_routes(self): routes_path = 'curryproxy/tests/etc/routes.forwarding_addresses.json' curry = CurryProxy(routes_path, self.logging_conf_path) self.assertEqual(2, len(curry._routes))
def test_config_invalid_path(self): with ExpectedException(IOError): CurryProxy('curryproxy/tests/etc/missing_file.json', self.logging_conf_path)
def test_config_invalid_json(self): with ExpectedException(ConfigError): CurryProxy('curryproxy/tests/etc/routes.invalid_json.json', self.logging_conf_path)
def test_config_supplied(self): route_file_path = 'curryproxy/tests/etc/routes.forwarding_address.json' curry = CurryProxy(route_file_path) self.assertEqual(1, len(curry._routes))
def setUp(self): super(Test_Match_Route, self).setUp() self.src = "https://www.example.com" self.tgt = "https://new.example.com" self.curry = CurryProxy('curryproxy/tests/etc/') self.forward = next(config.make({'forwards': {self.src: self.tgt}}))
def setUp(self): super(Test_Match_Route, self).setUp() self.curry = CurryProxy('curryproxy/tests/etc/routes.empty.json', 'curryproxy/tests/etc/logging.console.conf')
# Included for convenience. Loads conf files from the default location # of /etc/curryproxy. # # Example usage: `gunicorn curryproxy.wsgi:app` # # FIXME: Not sure how to appropriately test this; presumably # /etc/curryproxy isn't guaranteed to be available in tox tests. Maybe a # chroot? from curryproxy import CurryProxy app = CurryProxy()
def setUp(self): super(Test__Call__, self).setUp() self.curry = CurryProxy('curryproxy/tests/etc')
def test_init(self): curry = CurryProxy(self.etc) self.assertIsInstance(curry, CurryProxy)