From 85bd717b7ad7a463d87faae06d7f174f4f00fc68 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Wed, 17 Feb 2021 16:45:50 +0300 Subject: Add integration test for "/gemma/version" endpoint --- tests/integration/test_gemma.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tests') 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) -- cgit v1.2.3