def setUp(self): self.instance_manager = Mock() self.messaging = Mock() config = dict() config['persistence'] = config_manager.get_configuration('persistence') config['messaging'] = config_manager.get_configuration('messaging') config['worker'] = config_manager.get_configuration('worker') config['instance'] = \ config_manager.get_instance_configuration('instance_environment') self.worker = DummyWorker(config=config, persistence=self.instance_manager, messaging=self.messaging)
def setUp(self): self.config = config_manager.get_configuration( section_name='persistence', config_file='tests/files/config.ini', variables_file='tests/files/envvars.ini') self.config['database'] = 'metahosting_tests' self.store = MongoStore(config=self.config)
def setUp(self): config = config_manager.get_configuration( section_name='messaging', config_file='tests/files/config.ini', variables_file='tests/files/envvars.ini') self.queue_name = 'testing_queue' self.manager = BlockingPikaManager(config=config, queue=self.queue_name)
def test_existing_config(self): configuration = get_configuration(section_name='some_section', config_file=self.config_file.name, variables_file=self.env_file.name) self.assertTrue('host' in configuration) self.assertTrue('port' in configuration) self.assertEquals(configuration['host'], 'foo') self.assertEquals(configuration['port'], '29192') self.assertFalse('foo' in configuration)
def run(): arguments = argument_parsing() logging_setup(arguments=arguments) if arguments.config: config_manager._CONFIG_FILE = arguments.config if arguments.envfile: config_manager._VARIABLES_FILE = arguments.envfile config = dict() config['persistence'] = config_manager.get_configuration('persistence') config['messaging'] = config_manager.get_configuration('messaging') updater = Updater(config=config) signal.signal(signal.SIGTERM, updater.stop) signal.signal(signal.SIGHUP, updater.stop) signal.signal(signal.SIGINT, updater.stop) updater.start()
def run(): arguments = argument_parsing() logging_setup(arguments=arguments) if arguments.config: config_manager._CONFIG_FILE = arguments.config if arguments.envfile: config_manager._VARIABLES_FILE = arguments.envfile config = dict() config["persistence"] = config_manager.get_configuration("persistence") config["messaging"] = config_manager.get_configuration("messaging") updater = Updater(config=config) signal.signal(signal.SIGTERM, updater.stop) signal.signal(signal.SIGHUP, updater.stop) signal.signal(signal.SIGINT, updater.stop) updater.start()
def test_existing_env(self): os.environ['SOME_HOST_NAME'] = 'bar' os.environ['SOME_PORT_NAME'] = '6661' configuration = get_configuration(section_name='some_section', config_file=self.config_file.name, variables_file=self.env_file.name) self.assertTrue('host' in configuration) self.assertTrue('port' in configuration) self.assertEquals(configuration['host'], 'bar') self.assertEquals(configuration['port'], '6661') self.assertFalse('foo' in configuration) os.environ.pop('SOME_HOST_NAME') os.environ.pop('SOME_PORT_NAME')
def run(): arguments = argument_parsing() logging_setup(arguments=arguments) config = get_configuration('default') updater_class = get_backend_class(config, 'updaterbackend') messaging = get_backend_class(config=config, key='messagingbackend') updater = updater_class(config=config, messaging=messaging) signal.signal(signal.SIGTERM, updater.stop) signal.signal(signal.SIGHUP, updater.stop) signal.signal(signal.SIGINT, updater.stop) updater.start()
def test_get_backend_class(self): configuration = get_configuration(section_name='some_section', config_file=self.config_file.name, variables_file=self.env_file.name) backend_class = get_backend_class(configuration) self.assertTrue('Backend' in str(backend_class))
def test_not_existing_section(self): configuration = get_configuration('not-existing-section', config_file=self.config_file.name) self.assertIsNone(configuration)