Merge branch 'master' into csweaver/api-v2-init

This commit is contained in:
Charlotte Weaver
2018-08-13 15:48:06 -07:00
committed by GitHub
11 changed files with 1189 additions and 1180 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

+1 -1
View File
@@ -13,7 +13,7 @@ from .web import webapp
REACTIVE_LIMIT = 1_000_000 REACTIVE_LIMIT = 1_000_000
app = Flask(__name__) app = Flask(__name__, static_folder="web/static")
cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000}) cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000})
Compress(app) Compress(app)
CORS(app) CORS(app)
+4 -2
View File
@@ -1,7 +1,9 @@
import os
from flask import ( from flask import (
Blueprint, render_template, url_for, current_app Blueprint, render_template, send_from_directory, current_app
) )
bp = Blueprint("webapp", __name__, template_folder="templates") bp = Blueprint("webapp", __name__, template_folder="templates")
@@ -21,4 +23,4 @@ def swag():
# renders swagger documentation # renders swagger documentation
@bp.route("/favicon.png") @bp.route("/favicon.png")
def favicon(): def favicon():
return url_for("static", filename="img/favicon.png") return send_from_directory(os.path.join(bp.root_path, "static/img/"), "favicon.png")
+8 -1
View File
@@ -8,7 +8,9 @@ class EndPoints(unittest.TestCase):
def setUp(self): def setUp(self):
# Local # Local
self.url_base = "http://0.0.0.0:5005/api/" + "v0.1/" self.local_url = "http://127.0.0.1:5005/"
self.version = "v0.1"
self.url_base = "{local_url}api/{version}/".format(local_url=self.local_url, version=self.version)
self.session = requests.Session() self.session = requests.Session()
def test_cells(self): def test_cells(self):
@@ -51,3 +53,8 @@ class EndPoints(unittest.TestCase):
url = "{base}{endpoint}".format(base=self.url_base, endpoint="diffexpression") url = "{base}{endpoint}".format(base=self.url_base, endpoint="diffexpression")
result = self.session.post(url, data=json.dumps({"celllist1": ["AAACATACAACCAC-1", "AACCGATGGTCATG-1"], "celllist2": ["CCGATAGACCTAAG-1", "GGTGGAGAAGTAGA-1"]}), headers={'content-type': 'application/json'}) result = self.session.post(url, data=json.dumps({"celllist1": ["AAACATACAACCAC-1", "AACCGATGGTCATG-1"], "celllist2": ["CCGATAGACCTAAG-1", "GGTGGAGAAGTAGA-1"]}), headers={'content-type': 'application/json'})
assert result.status_code == 200 assert result.status_code == 200
def test_static(self):
url = "{url}{endpoint}/{file}".format(url=self.local_url, endpoint="static", file="js/service-worker.js")
result = self.session.get(url)
assert result.status_code == 200