Add test to make sure static files are served

this required that I break up the base url from the api route.
This commit is contained in:
Charlotte Weaver
2018-08-13 10:33:59 -07:00
parent 21a1f00a64
commit a4464d107f
+8 -2
View File
@@ -8,7 +8,9 @@ class EndPoints(unittest.TestCase):
def setUp(self):
# 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()
def test_cells(self):
@@ -51,4 +53,8 @@ class EndPoints(unittest.TestCase):
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'})
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