aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2021-02-16 16:16:33 +0300
committerBonfaceKilz2021-02-16 16:22:11 +0300
commitca3ed6f2c954649429275d544f3e48a00ab4905a (patch)
tree3f8cce5abbe11c91d4431321fa1656e080070e94
parent227577e0532787fe58da85b0aab02e686ecc6662 (diff)
downloadgenenetwork3-ca3ed6f2c954649429275d544f3e48a00ab4905a.tar.gz
Add new test cases for run_cmd
-rw-r--r--tests/unit/test_commands.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_commands.py b/tests/unit/test_commands.py
index a1ac6eb..b0c217d 100644
--- a/tests/unit/test_commands.py
+++ b/tests/unit/test_commands.py
@@ -8,6 +8,7 @@ from typing import Callable
from unittest import mock
from gn3.commands import compose_gemma_cmd
from gn3.commands import queue_cmd
+from gn3.commands import run_cmd
from gn3.exceptions import RedisConnectionError
@@ -70,3 +71,13 @@ class TestCommands(unittest.TestCase):
mock.call("status", "queued", actual_unique_id)])
mock_redis_conn.rpush.assert_has_calls(
[mock.call("GN2::job-queue", actual_unique_id)])
+
+ def test_run_cmd_correct_input(self):
+ """Test that a correct cmd is processed correctly"""
+ self.assertEqual(run_cmd("echo test"),
+ {"code": 0, "output": "test\n"})
+
+ def test_run_cmd_incorrect_input(self):
+ """Test that an incorrect cmd is processed correctly"""
+ result = run_cmd("echoo test")
+ self.assertEqual(127, result.get("code"))