diff --git a/tests/unit/test_cli/__init__.py b/tests/unit/test_cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/test_cli/test_http/__init__.py b/tests/unit/test_cli/test_http/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/test_cli/test_http/test_api/__init__.py b/tests/unit/test_cli/test_http/test_api/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/test_cli/test_http/test_api/test_command_arguments.py b/tests/unit/test_cli/test_http/test_api/test_command_arguments.py new file mode 100644 index 0000000..cc18b9f --- /dev/null +++ b/tests/unit/test_cli/test_http/test_api/test_command_arguments.py @@ -0,0 +1,22 @@ +import argparse + +import pytest + +from enapter.cli.http.api import command_arguments + + +def test_parse_command_arguments_none(): + assert command_arguments.parse_command_arguments(None) == {} + + +def test_parse_command_arguments_valid_json(): + assert command_arguments.parse_command_arguments('{"foo": "bar", "baz": 1}') == { + "foo": "bar", + "baz": 1, + } + + +def test_parse_command_arguments_invalid_json(): + with pytest.raises(argparse.ArgumentTypeError) as excinfo: + command_arguments.parse_command_arguments("invalid json") + assert "Decode JSON:" in str(excinfo.value)