forked from BioAnalyticResource/BAR_API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_proxy.py
More file actions
35 lines (29 loc) · 1.34 KB
/
test_proxy.py
File metadata and controls
35 lines (29 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from api import app
from json import load
import unittest
@unittest.skip("External")
class TestIntegrations(unittest.TestCase):
def setUp(self):
self.app_client = app.test_client()
def test_get_atted_api5(self):
"""This tests the data returned by the Atted proxy
:return:
"""
# Valid data
response = self.app_client.get("/proxy/atted_api5/At1g01010/5")
# Note: pytest is running from project root. So path is relative to project root
with open("tests/data/get_atted_api5.json") as json_file:
expected = load(json_file)
self.assertEqual(response.json, expected)
# Invalid gene
response = self.app_client.get("/proxy/atted_api5/At1g0101x/5")
expected = {"wasSuccessful": False, "error": "Invalid gene id"}
self.assertEqual(response.json, expected)
# If no data, the service should return this response
response = self.app_client.get("/proxy/atted_api5/At1g01011/5")
expected = {"error": "No gene ID specified.", "status_code": 400}
self.assertEqual(response.json, expected)
# Invalid topN count
response = self.app_client.get("proxy/atted_api5/At1g01010/9999999999999999999")
expected = {"wasSuccessful": False, "error": "Invalid count"}
self.assertEqual(response.json, expected)