aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabui2021-09-22 00:48:37 +0300
committerAlexander Kabui2021-09-22 00:48:37 +0300
commit580778386f054706086d7ab3d49f2c4f91f110e0 (patch)
treeab7728b1934dc2b67558e38c0d784c5199b8f366
parentab8b53a50a601cb95dc0b54279246431c791dd70 (diff)
downloadgenenetwork3-580778386f054706086d7ab3d49f2c4f91f110e0.tar.gz
init endpoint tests for wgcna
-rw-r--r--tests/integration/test_wgcna.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/integration/test_wgcna.py b/tests/integration/test_wgcna.py
new file mode 100644
index 0000000..65763c1
--- /dev/null
+++ b/tests/integration/test_wgcna.py
@@ -0,0 +1,37 @@
+"""integration tests for wgcna"""
+
+from unittest import TestCase
+from unittest import mock
+
+from gn3.app import create_app
+
+
+class WgcnaIntegrationTest(TestCase):
+ """class contains wgcna integration tests"""
+
+ def setUp(self):
+ self.app = create_app().test_client()
+
+ @mock.patch("gn3.api.wgcna.call_wgcna_script")
+ def test_wgcna_endpoint(self, mock_wgcna_api):
+ """test /api/wgcna/run_wgcna endpoint"""
+
+ wgcna_api_data = {
+ "eigengenes": ["1224_at", "121412_at", "32342342-at"],
+ "dendrogram_file_location": "/tmp/dend1.png"
+
+ }
+ mock_wgcna_api.return_value = wgcna_api_data
+
+ request_data = {
+
+ "trait_sample_data": [],
+
+
+ }
+
+ response = self.app.post("/api/wgcna/run_wgcna",
+ json=request_data, follow_redirects=True)
+
+ self.assertEqual(response.status_code, 200)
+ self.assertEqual(response.get_json(), wgcna_api_data)