def test_host_is_non_string(self): config = PluginCallConfiguration({}, {importer_constants.KEY_PROXY_HOST: 7}) try: importer_config.validate_proxy_host(config) self.fail() except ValueError, e: self.assertTrue('int' in e[0])
def test_required_when_other_parameters_are_present(self): dependent_parameters = ( {importer_constants.KEY_PROXY_PASS : '******'}, {importer_constants.KEY_PROXY_USER : '******'}, {importer_constants.KEY_PROXY_PORT : 8080}, ) for parameters in dependent_parameters: # Each of the above configurations should cause the validator to complain about # the proxy_url missing config = PluginCallConfiguration({}, parameters) try: importer_config.validate_proxy_host(config) self.fail() except ValueError, e: self.assertTrue(importer_constants.KEY_PROXY_HOST in e[0])
def test_required_when_other_parameters_are_present(self): dependent_parameters = ( {importer_constants.KEY_PROXY_PASS: '******'}, {importer_constants.KEY_PROXY_USER: '******'}, {importer_constants.KEY_PROXY_PORT: 8080}, ) for parameters in dependent_parameters: # Each of the above configurations should cause the validator to complain about # the proxy_url missing config = PluginCallConfiguration({}, parameters) try: importer_config.validate_proxy_host(config) self.fail() except ValueError, e: self.assertTrue(importer_constants.KEY_PROXY_HOST in e[0])
def test_optional(self): config = PluginCallConfiguration({}, {}) importer_config.validate_proxy_host(config)
def test_validate(self): config = PluginCallConfiguration( {}, {importer_constants.KEY_PROXY_HOST: 'http://fake.com/'}) importer_config.validate_proxy_host(config)
def test_validate(self): config = PluginCallConfiguration({}, {importer_constants.KEY_PROXY_HOST: 'http://fake.com/'}) importer_config.validate_proxy_host(config)