Files
cleveragents-core/tests/features/inline_jinja_handler_direct.feature
T

81 lines
3.3 KiB
Gherkin

Feature: InlineJinjaHandler Direct Testing
As a developer
I want to test the InlineJinjaHandler class directly
So that we achieve 90%+ code coverage
Background:
Given I have a clean test environment
Scenario: Test InlineJinjaHandler initialization
When I create an InlineJinjaHandler instance
Then the Jinja environment should be properly configured
Scenario: Test process_yaml_file with non-template content
Given I have a YAML file with no templates
When I process the file with defer_rendering True
Then it should return normal YAML parsing
Scenario: Test process_yaml_file with templates and deferred rendering
Given I have a YAML file with Jinja templates
When I process the file with defer_rendering True
Then it should extract templates using the handler
Scenario: Test process_yaml_string with templates and immediate rendering
Given I have a YAML string with Jinja templates
And I have template variables
When I process the string with defer_rendering False and context
Then it should render templates and return YAML
Scenario: Test template extraction from complex YAML
Given I have YAML with both inline and block templates
When I extract templates using the handler
Then templates should be replaced with placeholders
And template metadata should be stored
Scenario: Test apply_templates functionality
Given I have a config with template placeholders
And I have template metadata stored
And I have rendering variables
When I apply the templates to the config
Then placeholders should be replaced with rendered values
Scenario: Test _render_template_string method
Given I have a template string
And I have context variables
When I render the template string directly
Then variables should be substituted correctly
Scenario: Test _parse_rendered_value with various types
Given I have various rendered string values to parse
When I parse each value using the handler
Then each should be converted to appropriate Python types
Scenario: Test error handling in process_yaml_file
Given I have an invalid file path
When I try to process the invalid file
Then a FileNotFoundError should be raised appropriately
Scenario: Test edge cases in template extraction
Given I have YAML with edge case template syntax
When I extract templates
Then the handler should process them correctly
Scenario: Test recursive template application
Given I have nested configuration with multiple template levels
When I apply templates recursively
Then all nested placeholders should be resolved
Scenario: Test process_yaml_string with immediate rendering and no context
Given I have a YAML string with simple templates
When I process the string with defer_rendering False and no context
Then it should render with empty context successfully
Scenario: Test apply_templates with config without templates
Given I have a config without template placeholders
When I apply templates to the config
Then it should return the config unchanged
Scenario: Test apply_templates with block templates
Given I have a config with block template placeholders
When I apply templates with block template context
Then block templates should be rendered correctly