def setUp(self): super(TestController, self).setUp() self.mox = mox.Mox() self.sm = self.mox.CreateMockAnything() self.db = self.mox.CreateMockAnything() self.request = self.mox.CreateMockAnything() self.conf = config.get_config_object(args=[]) self.controller = v1_xfer.XferController(self.db, self.sm, self.conf)
def main(): try: conf = config.get_config_object() sched = scheduler.get_scheduler(conf) sched.start() sched.wait() except RuntimeError as e: fail(1, e)
def setUp(self): super(ApiTestBase, self).setUp() self.test_dir = self.get_tempdir() self.sql_connection = 'sqlite://' self.conf = config.get_config_object(args=[]) self.config(sql_connection=self.sql_connection) self.write_protocol_module_file() self.config(db_auto_create=True) self.needs_database = True
def test_protocol_policy_retrieve(self): conf = config.get_config_object(args=[]) p_file = self.get_tempfile() policy = {"hello": "world"} fptr = open(p_file, 'w') fptr.write(json.dumps(policy)) fptr.close() conf.protocol_policy = p_file j = config.get_protocol_policy(conf) self.assertEqual(j, policy)
def main(): try: conf = config.get_config_object() paste_file = conf.find_file(conf.paste_deploy.config_file) wsgi_app = os_pastedeploy.paste_deploy_app(paste_file, 'staccato-api', conf) server = os_wsgi.Service(wsgi_app, conf.bind_port) server.start() server.wait() except RuntimeError as e: fail(1, e)
def setUp(self): super(TestDB, self).setUp() self.owner = "someperson" self.tmp_db = self.get_tempfile() self.db_url = "sqlite:///%s" % (self.tmp_db) conf_d = {"sql_connection": self.db_url, "protocol_policy": ""} self.conf_file = self.make_confile(conf_d) self.conf = config.get_config_object(args=[], default_config_files=[self.conf_file]) self.db = self.make_db(self.conf)
def main(): try: conf = config.get_config_object() paste_file = conf.find_file(conf.paste_deploy.config_file) if conf.paste_deploy.flavor is None: flavor = 'staccato-api' else: flavor = 'staccato-api-' + conf.paste_deploy.flavor log.setup('staccato') wsgi_app = os_pastedeploy.paste_deploy_app(paste_file, flavor, conf) server = os_wsgi.Service(wsgi_app, conf.bind_port) server.start() server.wait() except RuntimeError as e: fail(1, e)
def test_db_connection_default(self): conf = config.get_config_object(args=[]) self.assertEquals(conf.sql_connection, 'sqlite:///staccato.sqlite')
def test_protocol_policy_retrieve_none(self): conf = config.get_config_object(args=[]) conf.protocol_policy = None j = config.get_protocol_policy(conf) self.assertEqual(j, {})
def test_load_paste_app_error(self): conf = config.get_config_object(args=[]) p_file = self.get_tempfile() self.assertRaises(RuntimeError, common_utils.load_paste_app, "notthere", p_file, conf)