diff options
author | BonfaceKilz | 2021-02-17 16:45:50 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-02-24 14:20:29 +0300 |
commit | 85bd717b7ad7a463d87faae06d7f174f4f00fc68 (patch) | |
tree | 90dd3cd32a383d4bb76787f6670526d20574abba | |
parent | dab1ec0d819df91cb61775bb885b0c6d72b144f1 (diff) | |
download | genenetwork3-85bd717b7ad7a463d87faae06d7f174f4f00fc68.tar.gz |
Add integration test for "/gemma/version" endpoint
-rw-r--r-- | tests/integration/test_gemma.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/integration/test_gemma.py b/tests/integration/test_gemma.py index 3afbc0c..676812d 100644 --- a/tests/integration/test_gemma.py +++ b/tests/integration/test_gemma.py @@ -1,6 +1,7 @@ """Integration tests for gemma API endpoints""" import unittest +from unittest import mock from gn3.app import create_app @@ -9,7 +10,11 @@ class GemmaAPITest(unittest.TestCase): def setUp(self): self.app = create_app().test_client() - def test_gemma_index(self): + @mock.patch("gn3.api.gemma.run_cmd") + def test_get_version(self, mock_run_cmd): """Test that the correct response is returned""" - response = self.app.get("/gemma", follow_redirects=True) - self.assertEqual(response.get_json().get("result"), "hello world") + mock_run_cmd.return_value = {"status": 0, "output": "v1.9"} + response = self.app.get("/gemma/version", follow_redirects=True) + self.assertEqual(response.get_json(), + {"status": 0, "output": "v1.9"}) + self.assertEqual(response.status_code, 200) |