def test_home_status_code(self): # assert the status code of the response. Add mock session and initialize temp db with self.app as c: with c.session_transaction() as sess: sess['logged_in'] = True sess['username'] = "******" with self.app.application.app_context(): init_db() result = self.app.get('/') self.assertEqual(result.status_code, 200)
def main(fname, from_date, to_date): symbols = load_symbols(fname) if not check_db(): init_db(symbols, from_date, to_date) strategy_inputs = [ ('CDL3LINESTRIKE', -100, 'buy', 10, 1.5), ('CDLMORNINGDOJISTAR', 100, 'buy', 7, 1.0)] for x in strategy_inputs: sr = StrategyRunner(*x)(symbols, from_date, to_date) break
import global_vars # argparse parser = argparse.ArgumentParser( description="Flags for Sundial Backend: Developed by NAEK (https://naek.ca)" ) parser.add_argument("--https", action="store_true") args = parser.parse_args() # flask setup app = flask.Flask(__name__) app.config["DEBUG"] = True # generate initial database if not os.path.isfile("db.db"): init_db() import routes.index_route import routes.task_routes import routes.account_routes import routes.weather_routes import routes.notification_routes if args.https: app.run( host="0.0.0.0", ssl_context=( "/etc/letsencrypt/live/sundial.vinhnguyen.ca/fullchain.pem", "/etc/letsencrypt/live/sundial.vinhnguyen.ca/privkey.pem", ), )