コード例 #1
0
    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)
コード例 #2
0
    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))
コード例 #3
0
 def test_config_invalid_path(self):
     with ExpectedException(IOError):
         CurryProxy('curryproxy/tests/etc/missing_file.json',
                    self.logging_conf_path)
コード例 #4
0
 def test_config_invalid_json(self):
     with ExpectedException(ConfigError):
         CurryProxy('curryproxy/tests/etc/routes.invalid_json.json',
                    self.logging_conf_path)
コード例 #5
0
    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))
コード例 #6
0
 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}}))
コード例 #7
0
    def setUp(self):
        super(Test_Match_Route, self).setUp()

        self.curry = CurryProxy('curryproxy/tests/etc/routes.empty.json',
                                'curryproxy/tests/etc/logging.console.conf')
コード例 #8
0
# 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()
コード例 #9
0
    def setUp(self):
        super(Test__Call__, self).setUp()

        self.curry = CurryProxy('curryproxy/tests/etc')
コード例 #10
0
 def test_init(self):
     curry = CurryProxy(self.etc)
     self.assertIsInstance(curry, CurryProxy)