Fix tests.
This commit is contained in:
parent
1fb9144192
commit
6ed459be6f
@ -102,6 +102,9 @@ class TestHandleQuestion(unittest.TestCase):
|
||||
source=None,
|
||||
only_source_code=False,
|
||||
number=3,
|
||||
max_tokens=None,
|
||||
temperature=None,
|
||||
model=None,
|
||||
match_all_tags=False,
|
||||
with_tags=False,
|
||||
with_file=False,
|
||||
@ -109,18 +112,19 @@ class TestHandleQuestion(unittest.TestCase):
|
||||
self.config = {
|
||||
'db': 'test_files',
|
||||
'setting1': 'value1',
|
||||
'setting2': 'value2'
|
||||
'setting2': 'value2',
|
||||
'openai': {},
|
||||
}
|
||||
|
||||
@patch("chatmastermind.main.create_chat_hist", return_value="test_chat")
|
||||
@patch("chatmastermind.main.print_tag_args")
|
||||
@patch("chatmastermind.utils.print_chat_hist")
|
||||
@patch("chatmastermind.main.print_chat_hist")
|
||||
@patch("chatmastermind.main.ai", return_value=(["answer1", "answer2", "answer3"], "test_usage"))
|
||||
@patch("chatmastermind.utils.pp")
|
||||
@patch("builtins.print")
|
||||
def test_ask_cmd(self, mock_print, mock_pp, mock_ai,
|
||||
mock_print_tag_args, mock_create_chat_hist,
|
||||
mock_print_chat_hist):
|
||||
mock_print_chat_hist, mock_print_tag_args,
|
||||
mock_create_chat_hist):
|
||||
open_mock = MagicMock()
|
||||
with patch("chatmastermind.storage.open", open_mock):
|
||||
ask_cmd(self.args, self.config)
|
||||
@ -135,7 +139,6 @@ class TestHandleQuestion(unittest.TestCase):
|
||||
mock_print_chat_hist.assert_called_once_with('test_chat',
|
||||
False,
|
||||
self.args.only_source_code)
|
||||
mock_pp.assert_called_once_with("test_chat")
|
||||
mock_ai.assert_called_with("test_chat",
|
||||
self.config,
|
||||
self.args.number)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user