aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBonfaceKilz2021-03-03 11:51:29 +0300
committerBonfaceKilz2021-03-08 21:09:58 +0300
commit87a3e2254bdd837e9647c42b9c4ab98e986c5e1d (patch)
tree4f4622d2b3b679b48f22fb31c112edba0d2c637e /tests
parent3b2b49ba367cf33adc294809feeb917b10f340a0 (diff)
downloadgenenetwork3-87a3e2254bdd837e9647c42b9c4ab98e986c5e1d.tar.gz
Add new endpoint: "/gemma/k-compute/<token>"
* gn3/api/gemma.py (compute_k): New function. * tests/integration/test_gemma.py (tesk_k_compute): New test case.
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_gemma.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/integration/test_gemma.py b/tests/integration/test_gemma.py
index e434dab..5f4e52b 100644
--- a/tests/integration/test_gemma.py
+++ b/tests/integration/test_gemma.py
@@ -149,3 +149,30 @@ class GemmaAPITest(unittest.TestCase):
key="status")
self.assertEqual(response.get_json(),
{"status": "test"})
+
+ @mock.patch("gn3.api.gemma.queue_cmd")
+ @mock.patch("gn3.api.gemma.generate_gemma_computation_cmd")
+ @mock.patch("gn3.api.gemma.get_hash_of_files")
+ @mock.patch("gn3.api.gemma.jsonfile_to_dict")
+ def test_k_compute(self, mock_json, mock_hash, mock_cmd,
+ mock_queue_cmd):
+ """Test /gemma/k-compute/<token>"""
+ mock_queue_cmd.return_value = "my-unique-id"
+ mock_json.return_value = {
+ "geno": "genofile.txt",
+ "pheno": "phenofile.txt",
+ "snps": "snpfile.txt",
+ }
+ mock_hash.return_value = "hash"
+ mock_cmd.return_value = ("gemma-wrapper --json -- "
+ "-debug -g "
+ "genotype_name.txt "
+ "-p traitfilename.txt "
+ "-a genotype_snps.txt "
+ "-gk > k_output_filename.json")
+ response = self.app.post("/gemma/k-compute/test-data")
+ self.assertEqual(response.get_json(), {
+ "output_file": "hash-k-output.json",
+ "status": "queued",
+ "unique_id": "my-unique-id"
+ })