102 lines
5.2 KiB
Gherkin
102 lines
5.2 KiB
Gherkin
Feature: Org User Config Domain Model Coverage
|
|
"""
|
|
Test coverage for the OrgUserConfig domain model.
|
|
Targets 100% coverage of src/cleveragents/domain/models/orguserconfig/org_user_config.py
|
|
"""
|
|
|
|
Background: Common setup
|
|
Given the cleveragents package is available
|
|
|
|
Scenario: Import and instantiate OrgUserConfig with all fields
|
|
When I import OrgUserConfig from orguserconfig
|
|
Then the OrgUserConfig class should be available
|
|
And I can create an OrgUserConfig with all required fields
|
|
|
|
Scenario: Create OrgUserConfig with prompted_claude_max field
|
|
When I create an OrgUserConfig with prompted_claude_max set to True
|
|
Then the OrgUserConfig should have prompted_claude_max as True
|
|
And the field should be accessible via the alias "promptedClaudeMax"
|
|
|
|
Scenario: Create OrgUserConfig with use_claude_subscription field
|
|
When I create an OrgUserConfig with use_claude_subscription set to False
|
|
Then the OrgUserConfig should have use_claude_subscription as False
|
|
And the field should be accessible via the alias "useClaudeSubscription"
|
|
|
|
Scenario: Create OrgUserConfig with claude_subscription_cooldown_started_at field
|
|
When I create an OrgUserConfig with a specific cooldown timestamp
|
|
Then the OrgUserConfig should have the correct timestamp
|
|
And the field should be accessible via the alias "claudeSubscriptionCooldownStartedAt"
|
|
|
|
Scenario: Validate OrgUserConfig strips whitespace from string fields
|
|
When I create an OrgUserConfig with fields containing whitespace
|
|
Then OrgUserConfig string fields should have whitespace stripped
|
|
|
|
Scenario: Validate OrgUserConfig assignment validation
|
|
When I create an OrgUserConfig instance
|
|
And I update its fields with new values for OrgUserConfig
|
|
Then the OrgUserConfig assignment validation should be triggered
|
|
And the OrgUserConfig values should be properly validated
|
|
|
|
Scenario: Validate OrgUserConfig populate by name with camelCase aliases
|
|
When I create an OrgUserConfig using camelCase field aliases
|
|
Then the OrgUserConfig fields should be populated correctly by name
|
|
And both snake_case and camelCase access should work
|
|
|
|
Scenario: Validate OrgUserConfig with dictionary input using aliases
|
|
When I create an OrgUserConfig from a dictionary with camelCase keys
|
|
Then the model should correctly map aliased fields
|
|
And all fields should be accessible with snake_case names
|
|
|
|
Scenario: Test OrgUserConfig serialization with aliases
|
|
When I create an OrgUserConfig and serialize it
|
|
Then the serialized output should use the defined aliases
|
|
And the model should be deserializable from the serialized form
|
|
|
|
Scenario: Test OrgUserConfig validation with invalid datetime
|
|
When I try to create an OrgUserConfig with an invalid datetime string
|
|
Then an OrgUserConfig validation error should be raised
|
|
And the error should indicate the datetime field
|
|
|
|
Scenario: Test OrgUserConfig validation with missing required fields
|
|
When I try to create an OrgUserConfig without required fields
|
|
Then an OrgUserConfig validation error should be raised
|
|
And the error should list all missing required fields
|
|
|
|
Scenario: Test OrgUserConfig model_config settings
|
|
When I inspect the OrgUserConfig model configuration
|
|
Then OrgUserConfig str_strip_whitespace should be True
|
|
And OrgUserConfig validate_assignment should be True
|
|
And OrgUserConfig arbitrary_types_allowed should be False
|
|
And OrgUserConfig populate_by_name should be True
|
|
And OrgUserConfig use_enum_values should be True
|
|
|
|
Scenario: Test OrgUserConfig with timezone-aware datetime
|
|
When I create an OrgUserConfig with a timezone-aware datetime
|
|
Then the model should handle the timezone information correctly
|
|
And the datetime should be properly stored
|
|
|
|
Scenario: Test OrgUserConfig copy with update
|
|
When I create an OrgUserConfig and copy it with updates
|
|
Then the OrgUserConfig copy should have the updated values
|
|
And the OrgUserConfig original should remain unchanged
|
|
|
|
Scenario: Test OrgUserConfig model_dump with aliases
|
|
When I create an OrgUserConfig and call model_dump with by_alias=True
|
|
Then the output should use camelCase aliases
|
|
When I call model_dump with by_alias=False
|
|
Then the output should use snake_case field names
|
|
|
|
Scenario: Test OrgUserConfig model_dump_json
|
|
When I create an OrgUserConfig and call model_dump_json
|
|
Then the JSON output should be valid
|
|
And it should use the configured aliases by default
|
|
|
|
Scenario: Test OrgUserConfig field types validation
|
|
When I try to create an OrgUserConfig with wrong field types
|
|
Then validation errors should be raised for type mismatches
|
|
And the OrgUserConfig errors should clearly indicate the expected types
|
|
|
|
Scenario: Test OrgUserConfig __init__ coverage
|
|
When I import the orguserconfig __init__ module
|
|
Then the module should be loaded successfully
|
|
And the OrgUserConfig class should be importable from it |