diff options
author | BonfaceKilz | 2021-02-16 19:15:35 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-02-16 19:15:35 +0300 |
commit | 5901528848acbc82ad57bdb6f4c25c51a52ead5c (patch) | |
tree | bcd0539b64876f3b6eea853175acf0c6f7e09fe5 | |
parent | 8fe418159306c1d04e4a13a63a7cd2b5b52dd5d5 (diff) | |
download | genenetwork3-5901528848acbc82ad57bdb6f4c25c51a52ead5c.tar.gz |
Add basic integration tests to test out the API
-rw-r--r-- | gn3/api/gemma.py | 3 | ||||
-rw-r--r-- | tests/integration/__init__.py | 0 | ||||
-rw-r--r-- | tests/integration/test_gemma.py | 15 |
3 files changed, 17 insertions, 1 deletions
diff --git a/gn3/api/gemma.py b/gn3/api/gemma.py index ae23b34..30d486f 100644 --- a/gn3/api/gemma.py +++ b/gn3/api/gemma.py @@ -1,5 +1,6 @@ """Endpoints for running the gemma cmd""" from flask import Blueprint +from flask import jsonify gemma = Blueprint("gemma", __name__) @@ -7,4 +8,4 @@ gemma = Blueprint("gemma", __name__) @gemma.route("/") def index() -> str: """Test endpoint""" - return "hello world" + return jsonify(result="hello world") diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/integration/__init__.py diff --git a/tests/integration/test_gemma.py b/tests/integration/test_gemma.py new file mode 100644 index 0000000..3afbc0c --- /dev/null +++ b/tests/integration/test_gemma.py @@ -0,0 +1,15 @@ +"""Integration tests for gemma API endpoints""" +import unittest + +from gn3.app import create_app + + +class GemmaAPITest(unittest.TestCase): + """Test cases for the Gemma API""" + def setUp(self): + self.app = create_app().test_client() + + def test_gemma_index(self): + """Test that the correct response is returned""" + response = self.app.get("/gemma", follow_redirects=True) + self.assertEqual(response.get_json().get("result"), "hello world") |