diff options
| author | Martin Bielik <martin.bielik@instea.sk> | 2024-12-16 20:14:56 +0100 |
|---|---|---|
| committer | Martin Bielik <martin.bielik@instea.sk> | 2024-12-16 20:14:56 +0100 |
| commit | 082eb061b9233719a4c763905008a17d636b468f (patch) | |
| tree | 508c5826a551b1466b5285fd8cc1870dde21cf3c /tests | |
| parent | cb2ac5f7a672faeb7b81886b6c1f1481ef51f90d (diff) | |
| download | vim-ai-082eb061b9233719a4c763905008a17d636b468f.tar.gz | |
edit command role
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/context_test.py | 24 | ||||
| -rw-r--r-- | tests/resources/roles.ini | 2 |
2 files changed, 15 insertions, 11 deletions
diff --git a/tests/context_test.py b/tests/context_test.py index 16c6e10..869215d 100644 --- a/tests/context_test.py +++ b/tests/context_test.py @@ -67,34 +67,36 @@ def test_role_config(): assert 'simple role prompt:\nuser instruction:\nselected text' == actual_prompt def test_role_config_different_commands(): - context = make_ai_context({ + base = { 'config_default': default_config, 'config_extension': {}, 'user_instruction': '/test-role hello', 'user_selection': '', - 'command_type': 'chat', - }) + } + context = make_ai_context({ **base, 'command_type': 'chat' }) actual_config = context['config'] actual_prompt = context['prompt'] assert 'model-common' == actual_config['options']['model'] - assert 'https://localhost/chat' == actual_config['options']['endpoint_url'] assert '0' == actual_config['ui']['paste_mode'] assert 'preset_tab' == actual_config['ui']['open_chat_command'] assert 'hello' == actual_prompt + assert 'https://localhost/chat' == actual_config['options']['endpoint_url'] - context = make_ai_context({ - 'config_default': default_config, - 'config_extension': {}, - 'user_instruction': '/test-role hello', - 'user_selection': '', - 'command_type': 'complete', - }) + context = make_ai_context({ **base, 'command_type': 'complete' }) actual_config = context['config'] actual_prompt = context['prompt'] assert 'model-common' == actual_config['options']['model'] + assert '0' == actual_config['ui']['paste_mode'] + assert 'hello' == actual_prompt assert 'https://localhost/complete' == actual_config['options']['endpoint_url'] + + context = make_ai_context({ **base, 'command_type': 'edit' }) + actual_config = context['config'] + actual_prompt = context['prompt'] + assert 'model-common' == actual_config['options']['model'] assert '0' == actual_config['ui']['paste_mode'] assert 'hello' == actual_prompt + assert 'https://localhost/edit' == actual_config['options']['endpoint_url'] def test_multiple_role_configs(): context = make_ai_context({ diff --git a/tests/resources/roles.ini b/tests/resources/roles.ini index c77d272..66b77ca 100644 --- a/tests/resources/roles.ini +++ b/tests/resources/roles.ini @@ -10,6 +10,8 @@ model = model-common endpoint_url = https://localhost/chat [test-role.options-complete] endpoint_url = https://localhost/complete +[test-role.options-edit] +endpoint_url = https://localhost/edit [test-role.ui] paste_mode = 0 [test-role.ui-chat] |