def setUp(self): super(TestRestAPI, self).setUp() api.app.config['TESTING'] = True # Use the simple manager for API testing, so we may run # API tests even without a Redis DB available api.manager = managers.get_manager(name='simple') self.app = api.app.test_client()
def main(): config = ConfigParser.ConfigParser() try: # Read config file as first command line parameter config_file = sys.argv[1] config.read(config_file) # Use the configured manager manager_type = config.get("default", "manager") manager_configs = config.items(manager_type) # In case of duplicated configs, the last one wins manager_configs = {k: v for (k, v) in manager_configs} # Other configs debug = config.get("default", "debug") except IndexError: # Or else use defaults debug = False manager_type = "redis" manager_configs = {"host": "localhost", "port": 6379} global manager manager = managers.get_manager(manager_type, **manager_configs) app.run(debug=debug)