forked from HAL9000/cleveragents-core
136 lines
5.5 KiB
Gherkin
136 lines
5.5 KiB
Gherkin
Feature: Jinja YAML Preprocessor Focused Coverage
|
|
As a developer
|
|
I want to test the essential JinjaYAMLPreprocessor functionality
|
|
So that we achieve 90%+ code coverage
|
|
|
|
Background:
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
|
|
Scenario: Initialize JinjaYAMLPreprocessor with environment settings
|
|
When I create a JinjaYAMLPreprocessor processor
|
|
Then the environment should be configured with trim and lstrip blocks
|
|
|
|
Scenario: Load file without templates
|
|
Given I have a YAML file without templates for processor
|
|
When I load the file with processor
|
|
Then it should return parsed YAML content
|
|
|
|
Scenario: Load file with templates and context
|
|
Given I have a YAML file with templates for processor
|
|
And I have a context for processor
|
|
When I load the file with context with processor
|
|
Then it should render and parse the templates
|
|
|
|
Scenario: Load string without templates
|
|
Given I have a YAML string without templates for processor
|
|
When I load the string with processor
|
|
Then it should return parsed YAML content
|
|
|
|
Scenario: Load string with templates and context
|
|
Given I have a YAML string with templates for processor
|
|
And I have a context for processor
|
|
When I load the string with context with processor
|
|
Then it should render and parse the templates
|
|
|
|
Scenario: Load string for deferred processing
|
|
Given I have a YAML string with templates for processor
|
|
When I load the string without context with processor
|
|
Then it should preprocess for deferred rendering
|
|
|
|
Scenario: Render and parse with built-in utilities
|
|
Given I have YAML with templates for processor
|
|
And I have a context for processor
|
|
When I call render and parse directly
|
|
Then it should add utilities and render correctly
|
|
|
|
Scenario: Preprocess for storage with template blocks
|
|
Given I have YAML with template blocks for processor
|
|
When I call preprocess for storage directly
|
|
Then it should wrap blocks with template markers
|
|
|
|
Scenario: Preprocess for storage with inline templates
|
|
Given I have YAML with inline templates for processor
|
|
When I call preprocess for storage directly
|
|
Then it should wrap inline templates with markers
|
|
|
|
Scenario: Handle YAML parsing errors during preprocessing
|
|
Given I have problematic YAML for processor
|
|
When I preprocess and encounter YAML errors
|
|
Then it should log error and raise YAML exception
|
|
|
|
Scenario: Render deferred configuration
|
|
Given I have preprocessed configuration for processor
|
|
And I have a context for processor
|
|
When I render the deferred configuration with processor
|
|
Then it should restore and render templates
|
|
|
|
Scenario: Handle non-deferred configuration
|
|
Given I have regular configuration for processor
|
|
When I render as deferred with processor
|
|
Then it should return unchanged configuration
|
|
|
|
Scenario: Restore templates from inline markers
|
|
Given I have configuration with inline markers for processor
|
|
When I restore templates with processor
|
|
Then it should reconstruct inline template syntax
|
|
|
|
Scenario: Restore templates from block markers
|
|
Given I have configuration with block markers for processor
|
|
When I restore templates with processor
|
|
Then it should reconstruct block template syntax
|
|
|
|
Scenario: Restore templates from nested structures
|
|
Given I have nested configuration for processor
|
|
When I restore templates with processor
|
|
Then it should handle nested structures correctly
|
|
|
|
Scenario: Handle complex template block preprocessing
|
|
Given I have complex template blocks for processor
|
|
When I preprocess complex structure with processor
|
|
Then it should identify and wrap nested blocks
|
|
|
|
Scenario: Handle file not found errors
|
|
Given I have invalid file path for processor
|
|
When I try to load invalid file with processor
|
|
Then it should raise FileNotFoundError
|
|
|
|
Scenario: Handle empty YAML content
|
|
Given I have empty YAML for processor
|
|
When I load empty content with processor
|
|
Then it should handle empty content gracefully for processor
|
|
|
|
Scenario: Restore inline template value directly
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
Given I have inline template data for processor
|
|
When I restore templates with processor
|
|
Then it should return inline template value directly
|
|
|
|
Scenario: Restore template block with marker
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
Given I have template block with marker for processor
|
|
When I restore templates with processor
|
|
Then it should extract template content from block
|
|
|
|
Scenario: Skip jinja template marker strings
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
Given I have configuration with jinja marker strings for processor
|
|
When I restore templates with processor
|
|
Then it should skip jinja template markers
|
|
|
|
Scenario: Handle None values in dictionary
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
Given I have configuration with None values for processor
|
|
When I restore templates with processor
|
|
Then it should handle None values correctly
|
|
|
|
Scenario: Handle simple list items
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
Given I have list with simple items for processor
|
|
When I restore templates with processor
|
|
Then it should handle simple list items correctly
|
|
|
|
Scenario: Handle non-dict-list data
|
|
Given I have a JinjaYAMLPreprocessor processor
|
|
Given I have non-dict-list data for processor
|
|
When I restore templates with processor
|
|
Then it should return string representation |