def setUp(self): """ Define static instance variables and create redis/mysql objects as well as working test directory """ self.pairs = [pairs] self.startdate = startdate self.sum = xsum self.max = xmax self.min = xmin self.drawup = drawup self.drawdown = drawdown os.system("configstore package process_templates {} /etc".format( config_env)) config.create_config() # reload config self.days = days self.outputdir = "/tmp/test_data" self.intervals = [interval] self.logger = get_logger(__name__) self.logger.info("Setting up environment") self.redis = Redis(interval=self.intervals[0], test=True, test_data=True) self.dbase = Mysql(test=True, interval=self.intervals[0]) if not os.path.exists(self.outputdir): os.mkdir(self.outputdir)
def setUp(self): """ Define static instance variables and create redis/mysql objects as well as working test directory """ self.pairs = [pairs] self.startdate = startdate self.sum = xsum self.max = xmax self.min = xmin self.days = 15 self.outputdir = "/tmp/test_data" self.intervals = ["1h"] self.logger = get_logger(__name__) self.logger.info("Setting up environment") self.redis = Redis(interval=self.intervals[0], test=True, db=0) self.dbase = Mysql(test=True, interval=self.intervals[0]) if not os.path.exists(self.outputdir): os.mkdir(self.outputdir)
def __call__(self, environ, start_response): if environ['PATH_INFO'].startswith(self.prefix): environ['PATH_INFO'] = environ['PATH_INFO'][len(self.prefix):] environ['SCRIPT_NAME'] = self.prefix return self.app(environ, start_response) else: start_response('404', [('Content-Type', 'text/plain')]) return ["This url does not belong to the app.".encode()] APP = Flask(__name__, template_folder="/etc/gcapi", static_url_path='/etc/gcapi/', static_folder='/etc/gcapi') LOGGER = get_logger(__name__) HANDLER = LOGGER.handlers[0] APP.logger.addHandler(HANDLER) APP.wsgi_app = PrefixMiddleware(APP.wsgi_app, prefix='/api') SCHED = BackgroundScheduler(daemon=True) DATA = {} RULES = [] ALL = {} TEST = bool(len(sys.argv) > 1 and sys.argv[1] == '--test') TEST_TRADE = not ('HOST' in os.environ and os.environ['HOST'] == "prod") @APP.route('/') def trades(): """deployments page"""
def setUp(self): self.logger = get_logger(__name__) self.tearDown()