|
1 | 1 | from api import app |
2 | 2 | from unittest import TestCase |
3 | 3 | import json |
4 | | -from json import load |
5 | 4 |
|
6 | 5 |
|
7 | 6 | class TestIntegrations(TestCase): |
@@ -132,57 +131,3 @@ def test_post_itrns(self): |
132 | 131 | "error": "No data for the given species/genes", |
133 | 132 | } |
134 | 133 | self.assertEqual(data, expected) |
135 | | - |
136 | | - def test_mfinder(self): |
137 | | - """ |
138 | | - This function test mfinder via POST. |
139 | | - """ |
140 | | - # Valid request |
141 | | - with open("tests/data/mfinder_input.json") as json_file_1: |
142 | | - input_data = load(json_file_1) |
143 | | - response = self.app_client.post( |
144 | | - "/interactions/mfinder", |
145 | | - json=input_data, |
146 | | - ) |
147 | | - data = json.loads(response.get_data(as_text=True)) |
148 | | - with open("tests/data/mfinder_output.json") as json_file_2: |
149 | | - expected = load(json_file_2) |
150 | | - self.assertEqual(data, expected) |
151 | | - |
152 | | - # Invalid data structure |
153 | | - response = self.app_client.post("/interactions/mfinder", json={"data": {}}) |
154 | | - data = json.loads(response.get_data(as_text=True)) |
155 | | - expected = {"wasSuccessful": False, "error": {"data": ["Not a valid list."]}} |
156 | | - self.assertEqual(data, expected) |
157 | | - |
158 | | - response = self.app_client.post("/interactions/mfinder", json={"data": []}) |
159 | | - data = json.loads(response.get_data(as_text=True)) |
160 | | - expected = {"wasSuccessful": False, "error": "arr length 0!"} |
161 | | - self.assertEqual(data, expected) |
162 | | - |
163 | | - response = self.app_client.post( |
164 | | - "/interactions/mfinder", json={"data": [["AT5G67420", "AT1G12110"], ["AT5G67420"]]} |
165 | | - ) |
166 | | - data = json.loads(response.get_data(as_text=True)) |
167 | | - expected = {"wasSuccessful": False, "error": "inner arr length is not of length 2!"} |
168 | | - self.assertEqual(data, expected) |
169 | | - |
170 | | - response = self.app_client.post("/interactions/mfinder", json={"data": [["AT5G67420", "AT1G12110"], 1]}) |
171 | | - data = json.loads(response.get_data(as_text=True)) |
172 | | - expected = {"wasSuccessful": False, "error": {"data": {"1": ["Not a valid list."]}}} |
173 | | - self.assertEqual(data, expected) |
174 | | - |
175 | | - response = self.app_client.post( |
176 | | - "/interactions/mfinder", json={"data": [["AT5G67420", "AT1G12110"], ["AT5G67420", 1]]} |
177 | | - ) |
178 | | - data = json.loads(response.get_data(as_text=True)) |
179 | | - expected = {"wasSuccessful": False, "error": {"data": {"1": {"1": ["Not a valid string."]}}}} |
180 | | - self.assertEqual(data, expected) |
181 | | - |
182 | | - # Invalid gene ID |
183 | | - response = self.app_client.post( |
184 | | - "/interactions/mfinder", json={"data": [["AT1G01010", "AT5G01010"], ["001G01030", "AT2G03240"]]} |
185 | | - ) |
186 | | - data = json.loads(response.get_data(as_text=True)) |
187 | | - expected = {"wasSuccessful": False, "error": "Invalid gene ID contained!"} |
188 | | - self.assertEqual(data, expected) |
0 commit comments