217 lines
8.9 KiB
Gherkin
217 lines
8.9 KiB
Gherkin
Feature: AI Models Providers Coverage
|
|
As a developer
|
|
I want to ensure AI models provider classes are thoroughly tested
|
|
So that model provider configurations work correctly throughout the application
|
|
|
|
@unit @models
|
|
Scenario: Create ModelProviderExtraAuthVars with all fields
|
|
Given I import the ModelProviderExtraAuthVars class
|
|
When I create a ModelProviderExtraAuthVars with var "AWS_REGION"
|
|
And I set maybeJSONFilePath to true
|
|
And I set required to true
|
|
And I set default to "us-east-1"
|
|
Then the var field should equal "AWS_REGION"
|
|
And the maybe_j_s_o_n_file_path field should be true
|
|
And the required field should be true
|
|
And the default field should equal "us-east-1"
|
|
|
|
@unit @models
|
|
Scenario: Create ModelProviderExtraAuthVars with minimal fields
|
|
Given I import the ModelProviderExtraAuthVars class
|
|
When I create a ModelProviderExtraAuthVars with only var "API_KEY"
|
|
Then the var field should equal "API_KEY"
|
|
And the maybe_j_s_o_n_file_path field should be None
|
|
And the required field should be None
|
|
And the default field should be None
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars field validation
|
|
Given I import the ModelProviderExtraAuthVars class
|
|
When I create a ModelProviderExtraAuthVars with var " TRIMMED_VAR "
|
|
Then the var field should equal "TRIMMED_VAR"
|
|
And the model should strip whitespace from string fields
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars alias support
|
|
Given I import the ModelProviderExtraAuthVars class
|
|
When I create a ModelProviderExtraAuthVars using alias "maybeJSONFilePath"
|
|
Then the field should be accessible as maybe_j_s_o_n_file_path
|
|
And the model should populate by name
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars dict export
|
|
Given I have a ModelProviderExtraAuthVars instance
|
|
When I export it to dict with aliases
|
|
Then the dict should contain "maybeJSONFilePath" key
|
|
And the dict should not contain "maybe_j_s_o_n_file_path" key
|
|
|
|
@unit @models
|
|
Scenario: Create ModelProviderConfigSchema with all fields
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I create a ModelProviderConfigSchema with provider "ModelProviderOpenAI"
|
|
And I set base_url to "https://api.openai.com"
|
|
And I set custom_provider to "custom-gpt"
|
|
And I set has_a_w_s_auth to true
|
|
And I set has_claude_max_auth to false
|
|
And I set skip_auth to false
|
|
And I set local_only to false
|
|
And I set api_key_env_var to "OPENAI_API_KEY"
|
|
And I add extra_auth_vars list
|
|
Then the provider field should equal "ModelProviderOpenAI"
|
|
And the base_url field should equal "https://api.openai.com"
|
|
And the custom_provider field should equal "custom-gpt"
|
|
And the has_a_w_s_auth field should be true
|
|
And the has_claude_max_auth field should be false
|
|
And the skip_auth field should be false
|
|
And the local_only field should be false
|
|
And the api_key_env_var field should equal "OPENAI_API_KEY"
|
|
And the extra_auth_vars should be a list
|
|
|
|
@unit @models
|
|
Scenario: Create ModelProviderConfigSchema with minimal fields
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I create a ModelProviderConfigSchema with only required fields
|
|
Then the provider field should be set
|
|
And the base_url field should be set
|
|
And all optional fields should be None
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema with ModelProvider enum
|
|
Given I import the ModelProviderConfigSchema class
|
|
And I import the ModelProvider enum for provider config
|
|
When I create a ModelProviderConfigSchema with ModelProvider.ANTHROPIC
|
|
Then the provider field should equal "ModelProviderAnthropic"
|
|
And the model should use enum values
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema field validation
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I create a ModelProviderConfigSchema with whitespace in fields
|
|
Then all string fields should have whitespace stripped
|
|
And the model should validate assignment
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema alias support
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I create a ModelProviderConfigSchema using aliases
|
|
Then "baseUrl" should map to base_url
|
|
And "customProvider" should map to custom_provider
|
|
And "hasAWSAuth" should map to has_a_w_s_auth
|
|
And "hasClaudeMaxAuth" should map to has_claude_max_auth
|
|
And "skipAuth" should map to skip_auth
|
|
And "localOnly" should map to local_only
|
|
And "apiKeyEnvVar" should map to api_key_env_var
|
|
And "extraAuthVars" should map to extra_auth_vars
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema dict export with aliases
|
|
Given I have a ModelProviderConfigSchema instance
|
|
When I export it to dict with aliases
|
|
Then the dict should use camelCase keys
|
|
And "baseUrl" should be in the dict
|
|
And "hasAWSAuth" should be in the dict
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema with empty extra_auth_vars
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I create a ModelProviderConfigSchema with empty extra_auth_vars list
|
|
Then the extra_auth_vars should be an empty list
|
|
And the model should accept empty lists
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema with multiple extra_auth_vars
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I create a ModelProviderConfigSchema with multiple extra_auth_vars
|
|
Then each extra_auth_var should be a ModelProviderExtraAuthVars instance
|
|
And the list should maintain order
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema JSON serialization
|
|
Given I have a ModelProviderConfigSchema instance
|
|
When I serialize it to JSON
|
|
Then the JSON should be valid
|
|
And it should contain all set fields
|
|
And it should use aliases in the output
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema JSON deserialization
|
|
Given I have a JSON string with provider config
|
|
When I deserialize it to ModelProviderConfigSchema
|
|
Then the object should be correctly populated
|
|
And aliases should be resolved to field names
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars model config validation
|
|
Given I import the ModelProviderExtraAuthVars class
|
|
When I check the model configuration
|
|
Then str_strip_whitespace should be True
|
|
And validate_assignment should be True
|
|
And arbitrary_types_allowed should be False
|
|
And populate_by_name should be True
|
|
And use_enum_values should be True
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema model config validation
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I check the model configuration
|
|
Then str_strip_whitespace should be True
|
|
And validate_assignment should be True
|
|
And arbitrary_types_allowed should be False
|
|
And populate_by_name should be True
|
|
And use_enum_values should be True
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars field update
|
|
Given I have a ModelProviderExtraAuthVars instance
|
|
When I update the var field to "NEW_VAR"
|
|
Then the var field should equal "NEW_VAR"
|
|
And the update should be validated
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema field update
|
|
Given I have a ModelProviderConfigSchema instance
|
|
When I update the base_url field to "https://new-api.com"
|
|
Then the base_url field should equal "https://new-api.com"
|
|
And the update should be validated
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars copy with update
|
|
Given I have a ModelProviderExtraAuthVars instance
|
|
When I create a copy with updated fields
|
|
Then the copy should have new values
|
|
And the original should remain unchanged
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema copy with update
|
|
Given I have a ModelProviderConfigSchema instance
|
|
When I create a copy with updated fields
|
|
Then the copy should have new values
|
|
And the original should remain unchanged
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars equality comparison
|
|
Given I have two ModelProviderExtraAuthVars instances
|
|
When I compare them for equality
|
|
Then identical instances should be equal
|
|
And different instances should not be equal
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema equality comparison
|
|
Given I have two ModelProviderConfigSchema instances
|
|
When I compare them for equality
|
|
Then identical instances should be equal
|
|
And different instances should not be equal
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderExtraAuthVars are not hashable
|
|
Given I have ModelProviderExtraAuthVars instances
|
|
When I try to use them as dictionary keys
|
|
Then the instances should not work as dictionary keys
|
|
And a TypeError should be raised when hashing
|
|
|
|
@unit @models
|
|
Scenario: ModelProviderConfigSchema validation error
|
|
Given I import the ModelProviderConfigSchema class
|
|
When I try to create an instance with missing required fields
|
|
Then a validation error should be raised for missing fields
|
|
And the error should indicate missing fields |