@@ -455,8 +455,8 @@ class TestOpenAIMixinAllowedModels:
455455 """Test cases for allowed_models filtering functionality"""
456456
457457 async def test_list_models_with_allowed_models_filter (self , mixin , mock_client_with_models , mock_client_context ):
458- """Test that list_models filters models based on allowed_models set """
459- mixin .allowed_models = { "some-mock-model-id" , "another-mock-model-id" }
458+ """Test that list_models filters models based on allowed_models"""
459+ mixin .config . allowed_models = [ "some-mock-model-id" , "another-mock-model-id" ]
460460
461461 with mock_client_context (mixin , mock_client_with_models ):
462462 result = await mixin .list_models ()
@@ -470,8 +470,18 @@ async def test_list_models_with_allowed_models_filter(self, mixin, mock_client_w
470470 assert "final-mock-model-id" not in model_ids
471471
472472 async def test_list_models_with_empty_allowed_models (self , mixin , mock_client_with_models , mock_client_context ):
473- """Test that empty allowed_models set allows all models"""
474- assert len (mixin .allowed_models ) == 0
473+ """Test that empty allowed_models allows no models"""
474+ mixin .config .allowed_models = []
475+
476+ with mock_client_context (mixin , mock_client_with_models ):
477+ result = await mixin .list_models ()
478+
479+ assert result is not None
480+ assert len (result ) == 0 # No models should be included
481+
482+ async def test_list_models_with_omitted_allowed_models (self , mixin , mock_client_with_models , mock_client_context ):
483+ """Test that omitted allowed_models allows all models"""
484+ assert mixin .config .allowed_models is None
475485
476486 with mock_client_context (mixin , mock_client_with_models ):
477487 result = await mixin .list_models ()
@@ -488,7 +498,7 @@ async def test_check_model_availability_with_allowed_models(
488498 self , mixin , mock_client_with_models , mock_client_context
489499 ):
490500 """Test that check_model_availability respects allowed_models"""
491- mixin .allowed_models = { "final-mock-model-id" }
501+ mixin .config . allowed_models = [ "final-mock-model-id" ]
492502
493503 with mock_client_context (mixin , mock_client_with_models ):
494504 assert await mixin .check_model_availability ("final-mock-model-id" )
@@ -536,7 +546,7 @@ async def test_register_model_not_available(self, mixin, mock_client_with_models
536546
537547 async def test_register_model_with_allowed_models_filter (self , mixin , mock_client_with_models , mock_client_context ):
538548 """Test model registration with allowed_models filtering"""
539- mixin .allowed_models = { "some-mock-model-id" }
549+ mixin .config . allowed_models = [ "some-mock-model-id" ]
540550
541551 # Test with allowed model
542552 allowed_model = Model (
@@ -690,7 +700,7 @@ async def test_respects_allowed_models(self, config):
690700 mixin = CustomListProviderModelIdsImplementation (
691701 config = config , custom_model_ids = ["model-1" , "model-2" , "model-3" ]
692702 )
693- mixin .allowed_models = ["model-1" ]
703+ mixin .config . allowed_models = ["model-1" ]
694704
695705 result = await mixin .list_models ()
696706
0 commit comments