mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
APP-443: Fix key generation (#12726)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: tofarr <tofarr@gmail.com>
This commit is contained in:
@@ -149,11 +149,10 @@ async def test_store_llm_settings_new_settings():
|
||||
llm_base_url='https://api.example.com',
|
||||
)
|
||||
|
||||
# Mock the settings store
|
||||
mock_store = MagicMock()
|
||||
mock_store.load = AsyncMock(return_value=None) # No existing settings
|
||||
# No existing settings
|
||||
existing_settings = None
|
||||
|
||||
result = await store_llm_settings(settings, mock_store)
|
||||
result = await store_llm_settings(settings, existing_settings)
|
||||
|
||||
# Should return settings with the provided values
|
||||
assert result.llm_model == 'gpt-4'
|
||||
@@ -170,9 +169,6 @@ async def test_store_llm_settings_update_existing():
|
||||
llm_base_url='https://new.example.com',
|
||||
)
|
||||
|
||||
# Mock the settings store
|
||||
mock_store = MagicMock()
|
||||
|
||||
# Create existing settings
|
||||
existing_settings = Settings(
|
||||
llm_model='gpt-3.5',
|
||||
@@ -180,9 +176,7 @@ async def test_store_llm_settings_update_existing():
|
||||
llm_base_url='https://old.example.com',
|
||||
)
|
||||
|
||||
mock_store.load = AsyncMock(return_value=existing_settings)
|
||||
|
||||
result = await store_llm_settings(settings, mock_store)
|
||||
result = await store_llm_settings(settings, existing_settings)
|
||||
|
||||
# Should return settings with the updated values
|
||||
assert result.llm_model == 'gpt-4'
|
||||
@@ -197,9 +191,6 @@ async def test_store_llm_settings_partial_update():
|
||||
llm_model='gpt-4' # Only updating model
|
||||
)
|
||||
|
||||
# Mock the settings store
|
||||
mock_store = MagicMock()
|
||||
|
||||
# Create existing settings
|
||||
existing_settings = Settings(
|
||||
llm_model='gpt-3.5',
|
||||
@@ -207,9 +198,7 @@ async def test_store_llm_settings_partial_update():
|
||||
llm_base_url='https://existing.example.com',
|
||||
)
|
||||
|
||||
mock_store.load = AsyncMock(return_value=existing_settings)
|
||||
|
||||
result = await store_llm_settings(settings, mock_store)
|
||||
result = await store_llm_settings(settings, existing_settings)
|
||||
|
||||
# Should return settings with updated model but keep other values
|
||||
assert result.llm_model == 'gpt-4'
|
||||
|
||||
Reference in New Issue
Block a user