diff --git a/softpack_core/graphql.py b/softpack_core/graphql.py index 227af70..3a846e0 100644 --- a/softpack_core/graphql.py +++ b/softpack_core/graphql.py @@ -14,7 +14,6 @@ from typing_extensions import Type from .api import API -from .app import app from .schemas.base import BaseSchema from .schemas.environment import EnvironmentSchema from .schemas.groups import GroupsSchema @@ -32,16 +31,6 @@ class GraphQL(API): ] commands = Typer(help="GraphQL commands.") - @staticmethod - @commands.command("query", help="Execute a GraphQL query.") - def query_command() -> None: - """Execute a GraphQL query. - - Returns: - None. - """ - app.echo("GraphQL Query") - class Schema(strawberry.Schema): """GraphQL Schema class.""" diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 0cca742..8bdbcbf 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -43,7 +43,7 @@ def httpx_post(mocker): @pytest.fixture -def testable_env_input(mocker) -> EnvironmentInput: +def testable_env_input(mocker) -> EnvironmentInput: # type: ignore ad = new_test_artifacts() artifacts: Artifacts = ad["artifacts"] user = ad["test_user"] diff --git a/tests/unit/test_service.py b/tests/unit/test_service.py new file mode 100644 index 0000000..a41f2cf --- /dev/null +++ b/tests/unit/test_service.py @@ -0,0 +1,31 @@ +"""Copyright (c) 2023 Genome Research Ltd. + +This source code is licensed under the MIT license found in the +LICENSE file in the root directory of this source tree. +""" + +import multiprocessing +from time import sleep + +import httpx +from box import Box + +from softpack_core import __version__ +from softpack_core.app import app +from softpack_core.service import ServiceAPI + + +def test_service_run() -> None: + run = multiprocessing.Process(target=ServiceAPI.run) + run.start() + while True: + try: + response = httpx.get(app.url()) + break + except httpx.RequestError: + if not run.is_alive(): + raise Exception("Service failed to start.") + sleep(5) + run.terminate() + status = Box(response.json()) + assert status.softpack.core.version == __version__