# PR Description ### The following bug was observed: * When connected to the cloud engine for `arcade chat`, and the user types `/show`, then the local environment tools are displayed. Instead, the cloud engine's tools should be displayed. ### Why was this bug happening?: * When a user entered the `/show` command, the CLI Command `show` was being called directly. Since the function was a CLI command, the `local` parameter was not being processed and resolved to its intended value because the Typer CLI interface was being bypassed. So, the conditional `if local:` would always evaluate to `True`. ### How this was fixed: * I created a wrapper function for the `show` CLI Command. Now, when the user types `/show`, then the wrapper function is called instead of the `show` CLI command. This ensures that all input parameters are resolved to their intended values.
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
from unittest.mock import patch
|
|
|
|
from arcade.cli.show import show_logic
|
|
|
|
|
|
def test_show_logic_local_false():
|
|
with patch("arcade.cli.show.get_tools_from_engine") as mock_get_tools:
|
|
mock_get_tools.return_value = []
|
|
show_logic(
|
|
toolkit=None,
|
|
tool=None,
|
|
host="localhost",
|
|
local=False,
|
|
port=None,
|
|
force_tls=False,
|
|
force_no_tls=False,
|
|
debug=False,
|
|
)
|
|
|
|
# get_tools_from_engine should be called when local=False
|
|
mock_get_tools.assert_called_once()
|
|
|
|
|
|
def test_show_logic_local_true():
|
|
with patch("arcade.cli.show.create_cli_catalog") as mock_create_catalog:
|
|
mock_create_catalog.return_value = []
|
|
|
|
show_logic(
|
|
toolkit=None,
|
|
tool=None,
|
|
host="localhost",
|
|
local=True,
|
|
port=None,
|
|
force_tls=False,
|
|
force_no_tls=False,
|
|
debug=False,
|
|
)
|
|
|
|
# create_cli_catalog should be called when local=True
|
|
mock_create_catalog.assert_called_once()
|