Repository: AgnostiqHQ/covalent (language: python)

Issue:
failing benchmark workflow
Since [this merge](https://github.com/AgnostiqHQ/covalent/commit/54482420e4f2af6403c79cfe9a1949166704ee35/checks), benchmark workflows are failing. The failures appear to be `500` responses from the server, so this is a somewhat expected dispatcher breakage due to the DB work. Need to investigate where things are breaking exactly and confirm that the benchmarks can run.


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28a14d21e..2914dd8b9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Fixed
 
 - Updated import statements in alembic `env.py` file to refer to updated location of `DataStore` class
+- Imports in entry_point
 
 ### Docs
 
diff --git a/covalent_dispatcher/_core/__init__.py b/covalent_dispatcher/_core/__init__.py
index eab011719..cb43508c9 100644
--- a/covalent_dispatcher/_core/__init__.py
+++ b/covalent_dispatcher/_core/__init__.py
@@ -18,4 +18,4 @@
 #
 # Relief from the License may be granted by purchasing a commercial license.
 
-from .execution import cancel_workflow, run_workflow
+from .execution import cancel_workflow, initialize_result_object, run_workflow


Test patch:
diff --git a/tests/covalent_dispatcher_tests/entry_point_test.py b/tests/covalent_dispatcher_tests/entry_point_test.py
new file mode 100644
index 000000000..3eb0a0171
--- /dev/null
+++ b/tests/covalent_dispatcher_tests/entry_point_test.py
@@ -0,0 +1,55 @@
+# Copyright 2021 Agnostiq Inc.
+#
+# This file is part of Covalent.
+#
+# Licensed under the GNU Affero General Public License 3.0 (the "License").
+# A copy of the License may be obtained with this software package or at
+#
+#      https://www.gnu.org/licenses/agpl-3.0.en.html
+#
+# Use of this file is prohibited except in compliance with the License. Any
+# modifications or derivative works of this file must retain this copyright
+# notice, and modified files must contain a notice indicating that they have
+# been altered from the originals.
+#
+# Covalent is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
+#
+# Relief from the License may be granted by purchasing a commercial license.
+
+"""Unit tests for the FastAPI app."""
+
+
+import pytest
+
+from covalent_dispatcher.entry_point import cancel_running_dispatch, run_dispatcher
+
+DISPATCH_ID = "f34671d1-48f2-41ce-89d9-9a8cb5c60e5d"
+
+
+class MockObject:
+    pass
+
+
+def mock_initialize_result_object(lattice):
+    result = MockObject()
+    result.dispatch_id = lattice["dispatch_id"]
+    return result
+
+
+@pytest.mark.asyncio
+async def test_run_dispatcher(mocker):
+    mocker.patch(
+        "covalent_dispatcher._core.initialize_result_object", mock_initialize_result_object
+    )
+    mock_run_workflow = mocker.patch("covalent_dispatcher._core.run_workflow")
+    dispatch_id = await run_dispatcher({"dispatch_id": DISPATCH_ID})
+    assert dispatch_id == DISPATCH_ID
+    mock_run_workflow.assert_called_once()
+
+
+def test_cancel_running_dispatch(mocker):
+    mock_cancel_workflow = mocker.patch("covalent_dispatcher._core.cancel_workflow")
+    cancel_running_dispatch(DISPATCH_ID)
+    mock_cancel_workflow.assert_called_once_with(DISPATCH_ID)