diff options
Diffstat (limited to 'tests/integration/test_gemma.py')
-rw-r--r-- | tests/integration/test_gemma.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/integration/test_gemma.py b/tests/integration/test_gemma.py index 18e3fb0..3e64987 100644 --- a/tests/integration/test_gemma.py +++ b/tests/integration/test_gemma.py @@ -176,3 +176,31 @@ class GemmaAPITest(unittest.TestCase): "status": "queued", "unique_id": "my-unique-id" }) + + @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_loco(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(("/api/gemma/k-compute/loco/" + "1%2C2%2C3%2C4%2C5%2C6/test-data")) + self.assertEqual(response.get_json(), { + "output_file": "hash-k-output.json", + "status": "queued", + "unique_id": "my-unique-id" + }) |