Files
cleveragents-core/features/aimodelscredentials_coverage.feature
T

85 lines
4.2 KiB
Gherkin

Feature: AI Models Credentials Domain Model Coverage
"""
Test coverage for the AI Models Credentials domain model.
Targets 100% coverage of src/cleveragents/domain/models/aimodelscredentials/ai_models_credentials.py
"""
Background: Common setup
Given the cleveragents package is available
Scenario: Import and instantiate ModelProviderOption with all fields
When I import ModelProviderOption from aimodelscredentials
Then the ModelProviderOption class should be available
And I can create a ModelProviderOption with publishers, config, and priority
Scenario: Create ModelProviderOption with minimal required fields
When I create a ModelProviderOption with only priority set to 1
Then the ModelProviderOption should have priority 1
And the publishers dictionary should be empty
And the config should be None
Scenario: Create ModelProviderOption with publishers dictionary
When I create a ModelProviderOption with complex publishers structure
Then the publishers field should contain the expected dictionary structure
And the ModelPublisher enum values should be properly handled
Scenario: Create ModelProviderOption with ModelProviderConfigSchema
When I create a ModelProviderOption with a config object
Then the config field should contain the ModelProviderConfigSchema instance
And the config should be properly validated
Scenario: Validate ModelProviderOption strips whitespace
When I create a ModelProviderOption with strings containing whitespace
Then the string fields should have whitespace stripped
Scenario: Validate ModelProviderOption assignment validation
When I create a ModelProviderOption instance
And I update its fields with new values
Then the assignment validation should be triggered
And the values should be properly validated
Scenario: Validate ModelProviderOption populate by name
When I create a ModelProviderOption using field aliases
Then the fields should be populated correctly by name
Scenario: Validate ModelProviderOption use enum values
When I create a ModelProviderOption with ModelPublisher enums
Then the enum values should be used in serialization
And the model should handle enum values properly
Scenario: Test ModelProviderOption field defaults
When I create a ModelProviderOption with default fields
Then publishers should default to an empty dictionary
And config should default to None
Scenario: Test ModelProviderOption field validation with invalid data
When I try to create a ModelProviderOption with invalid priority
Then a ModelProviderOption validation error should be raised
And the error should indicate the priority field issue
Scenario: Test ModelProviderOption model config settings
When I examine the ModelProviderOption model_config
Then the ModelProviderOption str_strip_whitespace should be True
And the ModelProviderOption validate_assignment should be True
And the ModelProviderOption arbitrary_types_allowed should be False
And the ModelProviderOption populate_by_name should be True
And the ModelProviderOption use_enum_values should be True
Scenario: Test ModelProviderOption with nested publisher structures
When I create a ModelProviderOption with nested publisher dictionaries
Then the nested structure should be properly maintained
And the ModelPublisher boolean values should work correctly
Scenario: Test ModelProviderOption serialization and deserialization
When I serialize a ModelProviderOption to dict
And I deserialize it back to ModelProviderOption
Then the round-trip should preserve all data
Scenario: Test ModelProviderOption with None config field
When I explicitly set config to None in ModelProviderOption
Then the config field should accept None value
And the model should be valid
Scenario: Test ModelProviderOption priority field requirement
When I try to create a ModelProviderOption without priority
Then a ModelProviderOption validation error should be raised for missing required field