125 lines
6.1 KiB
Gherkin
125 lines
6.1 KiB
Gherkin
Feature: Deferred Template Coverage
|
|
As a developer
|
|
I want to test all functionality in the deferred_template module
|
|
So that we achieve 90%+ code coverage for the deferred_template.py file
|
|
|
|
Background:
|
|
Given I have a clean test environment for deferred templates
|
|
|
|
Scenario: DeferredTemplate initialization and basic usage
|
|
Given I have a simple template string with Jinja2 syntax
|
|
When I create a DeferredTemplate instance
|
|
Then the template should be stored correctly
|
|
And the YAMLTemplateProcessor should be initialized
|
|
|
|
Scenario: DeferredTemplate render method with context
|
|
Given I have a template string with template variables
|
|
And I have a template context with variable values
|
|
When I render the deferred template with context
|
|
Then the template should be processed using YAMLTemplateProcessor
|
|
And the result should contain the rendered content
|
|
|
|
Scenario: DeferredTemplate render method with complex template
|
|
Given I have a complex template string with multiple variables
|
|
And I have a comprehensive template context
|
|
When I render the deferred template with context
|
|
Then the template should be fully processed
|
|
And all variables should be substituted correctly
|
|
|
|
Scenario: DeferredTemplate from_yaml_section - missing key
|
|
Given I have a YAML dictionary without the target key
|
|
When I call from_yaml_section with the missing key
|
|
Then it should return None
|
|
|
|
Scenario: DeferredTemplate from_yaml_section - no template syntax
|
|
Given I have a YAML dictionary with a section without template syntax
|
|
When I call from_yaml_section with that key
|
|
Then it should return None
|
|
|
|
Scenario: DeferredTemplate from_yaml_section - with Jinja2 curly braces
|
|
Given I have a YAML dictionary with a section containing Jinja2 curly braces
|
|
When I call from_yaml_section with that key
|
|
Then it should return a DeferredTemplate instance
|
|
And the template string should contain the YAML section
|
|
|
|
Scenario: DeferredTemplate from_yaml_section - with Jinja2 control structures
|
|
Given I have a YAML dictionary with a section containing Jinja2 control structures
|
|
When I call from_yaml_section with that key
|
|
Then it should return a DeferredTemplate instance
|
|
And the template string should contain the control structures
|
|
|
|
Scenario: process_template_definition - no template sections
|
|
Given I have a template definition without template sections
|
|
When I call process_template_definition
|
|
Then it should return the original definition unchanged
|
|
|
|
Scenario: process_template_definition - with template sections without syntax
|
|
Given I have a template definition with sections but no template syntax
|
|
When I call process_template_definition
|
|
Then it should return the original definition unchanged
|
|
|
|
Scenario: process_template_definition - with components containing templates
|
|
Given I have a template definition with components containing template syntax
|
|
When I call process_template_definition
|
|
Then it should create a deferred template for components
|
|
And the original components should be replaced with a placeholder
|
|
And the deferred template should be stored with the correct key
|
|
|
|
Scenario: process_template_definition - with nodes containing templates
|
|
Given I have a template definition with nodes containing template syntax
|
|
When I call process_template_definition
|
|
Then it should create a deferred template for nodes
|
|
And the original nodes should be replaced with a placeholder
|
|
|
|
Scenario: process_template_definition - with edges containing templates
|
|
Given I have a template definition with edges containing template syntax
|
|
When I call process_template_definition
|
|
Then it should create a deferred template for edges
|
|
And the original edges should be replaced with a placeholder
|
|
|
|
Scenario: process_template_definition - with operators containing templates
|
|
Given I have a template definition with operators containing template syntax
|
|
When I call process_template_definition
|
|
Then it should create a deferred template for operators
|
|
And the original operators should be replaced with a placeholder
|
|
|
|
Scenario: process_template_definition - with routing containing templates
|
|
Given I have a template definition with routing containing template syntax
|
|
When I call process_template_definition
|
|
Then it should create a deferred template for routing
|
|
And the original routing should be replaced with a placeholder
|
|
|
|
Scenario: process_template_definition - with multiple sections containing templates
|
|
Given I have a template definition with multiple sections containing template syntax
|
|
When I call process_template_definition
|
|
Then it should create deferred templates for all applicable sections
|
|
And all original sections should be replaced with placeholders
|
|
|
|
Scenario: apply_deferred_templates - no deferred templates
|
|
Given I have a configuration without deferred templates
|
|
And I have a generic template context
|
|
When I call apply_deferred_templates
|
|
Then it should return the original configuration unchanged
|
|
|
|
Scenario: apply_deferred_templates - with deferred templates
|
|
Given I have a configuration with deferred template markers
|
|
And I have DeferredTemplate instances in the configuration
|
|
And I have a generic template context
|
|
When I call apply_deferred_templates
|
|
Then the deferred templates should be rendered
|
|
And the deferred markers should be removed
|
|
And the rendered content should replace the placeholders
|
|
|
|
Scenario: apply_deferred_templates - with nested rendered content
|
|
Given I have a configuration with deferred templates that render to nested dictionaries
|
|
And I have a generic template context
|
|
When I call apply_deferred_templates
|
|
Then the nested content should be extracted correctly
|
|
And the actual section should be populated with the nested content
|
|
|
|
Scenario: apply_deferred_templates - with direct rendered content
|
|
Given I have a configuration with deferred templates that render to direct content
|
|
And I have a generic template context
|
|
When I call apply_deferred_templates
|
|
Then the direct content should be used as-is
|
|
And the configuration should be updated correctly |