forked from cleveragents/cleveragents-core
213 lines
9.9 KiB
Gherkin
213 lines
9.9 KiB
Gherkin
Feature: Enhanced Template Registry Coverage
|
|
As a developer
|
|
I want to test all functionality in the enhanced template registry
|
|
So that we achieve 90%+ code coverage for the enhanced_registry.py file
|
|
|
|
Background:
|
|
Given EReg: I have a clean test environment for enhanced registry
|
|
|
|
Scenario: Test EnhancedTemplateRegistry initialization
|
|
Given EReg: I create an enhanced template registry
|
|
Then EReg: the registry should be initialized correctly
|
|
And EReg: the registry should have empty template caches
|
|
And EReg: the registry should have a template store
|
|
And EReg: the registry should have a YAML processor
|
|
|
|
Scenario: Test register_template_string with different template types
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template YAML string for agent type
|
|
When EReg: I register the template string with agent type
|
|
Then EReg: the template should be stored in the store
|
|
And EReg: the template should be accessible by type and name
|
|
|
|
Scenario: Test register_template_string with graph type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template YAML string for graph type
|
|
When EReg: I register the template string with graph type
|
|
Then EReg: the template should be stored in the store
|
|
And EReg: the template should be accessible by type and name
|
|
|
|
Scenario: Test register_template_string with stream type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template YAML string for stream type
|
|
When EReg: I register the template string with stream type
|
|
Then EReg: the template should be stored in the store
|
|
And EReg: the template should be accessible by type and name
|
|
|
|
Scenario: Test register_template_file functionality
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template file on disk
|
|
When EReg: I register the template from file
|
|
Then EReg: the template should be loaded from file and stored
|
|
And EReg: the file content should be registered as template string
|
|
|
|
Scenario: Test register_template_dict with Jinja2 syntax
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template dictionary with Jinja2 syntax
|
|
When EReg: I register the template dictionary
|
|
Then EReg: the template should be stored as YAML string
|
|
And EReg: the Jinja2 syntax should be preserved
|
|
|
|
Scenario: Test register_template_dict without Jinja2 syntax
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a simple template dictionary without Jinja2
|
|
When EReg: I register the simple template dictionary
|
|
Then EReg: the template should be registered as simple template
|
|
And EReg: the template should be cached in memory
|
|
|
|
Scenario: Test _register_simple_template for agent type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a simple agent template definition
|
|
When EReg: I register the simple agent template
|
|
Then EReg: an AgentTemplate instance should be created
|
|
And EReg: the template should be cached correctly
|
|
|
|
Scenario: Test _register_simple_template for composite agent type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a composite agent template definition for enhanced registry
|
|
When EReg: I register the composite agent template for enhanced registry
|
|
Then EReg: a CompositeAgentTemplate instance should be created
|
|
And EReg: the template should be cached correctly
|
|
|
|
Scenario: Test _register_simple_template for graph type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a simple graph template definition for enhanced registry
|
|
When EReg: I register the simple graph template in enhanced registry
|
|
Then EReg: a GraphTemplate instance should be created
|
|
And EReg: the template should be cached correctly
|
|
|
|
Scenario: Test _register_simple_template for stream type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a simple stream template definition for enhanced registry
|
|
When EReg: I register the simple stream template in enhanced registry
|
|
Then EReg: a StreamTemplate instance should be created
|
|
And EReg: the template should be cached correctly
|
|
|
|
Scenario: Test _register_simple_template with unknown type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template definition with unknown type
|
|
When EReg: I try to register the unknown template type
|
|
Then EReg: a ValueError should be raised for unknown type
|
|
|
|
Scenario: Test get_template from cache
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a cached template
|
|
When EReg: I get the template by type and name
|
|
Then EReg: the cached template should be returned
|
|
|
|
Scenario: Test get_template from store (complex template)
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a complex template in store only
|
|
When EReg: I try to get the complex template
|
|
Then EReg: a ValueError should be raised about complex template
|
|
|
|
Scenario: Test get_template not found
|
|
Given EReg: I create an enhanced template registry
|
|
When EReg: I try to get a non-existent template
|
|
Then EReg: a ValueError should be raised for template not found
|
|
|
|
Scenario: Test instantiate from cache
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a cached template with parameters
|
|
When EReg: I instantiate the cached template
|
|
Then EReg: the template instantiate method should be called
|
|
And EReg: the configuration should be returned
|
|
|
|
Scenario: Test instantiate from store
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template in store only
|
|
And EReg: I have template parameters
|
|
When EReg: I instantiate the template from store
|
|
Then EReg: the store instantiate method should be called
|
|
And EReg: the instantiated configuration should be returned
|
|
|
|
Scenario: Test instantiate with context processing
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template in store with context
|
|
And EReg: I have template parameters and context
|
|
When EReg: I instantiate the template with context
|
|
Then EReg: the context should be processed
|
|
And EReg: the instantiated configuration should be returned
|
|
|
|
Scenario: Test instantiate template not found
|
|
Given EReg: I create an enhanced template registry
|
|
When EReg: I try to instantiate a non-existent template
|
|
Then EReg: a ValueError should be raised for instantiate not found
|
|
|
|
Scenario: Test register_all_templates with agents
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a templates configuration with agents
|
|
When EReg: I register all templates from configuration
|
|
Then EReg: all agent templates should be registered
|
|
And EReg: the templates should be accessible
|
|
|
|
Scenario: Test register_all_templates with graphs
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a templates configuration with graphs
|
|
When EReg: I register all templates from configuration
|
|
Then EReg: all graph templates should be registered
|
|
And EReg: the templates should be accessible
|
|
|
|
Scenario: Test register_all_templates with streams
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a templates configuration with streams
|
|
When EReg: I register all templates from configuration
|
|
Then EReg: all stream templates should be registered
|
|
And EReg: the templates should be accessible
|
|
|
|
Scenario: Test register_all_templates with unknown type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a templates configuration with unknown type
|
|
When EReg: I register all templates from configuration
|
|
Then EReg: the unknown type should be logged as warning
|
|
And EReg: known types should still be processed
|
|
|
|
Scenario: Test has_template from cache
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a cached template
|
|
When EReg: I check if the template exists in enhanced registry
|
|
Then EReg: the result should be true
|
|
|
|
Scenario: Test has_template from store
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template in store only
|
|
When EReg: I check if the template exists in enhanced registry
|
|
Then EReg: the result should be true
|
|
|
|
Scenario: Test has_template not found
|
|
Given EReg: I create an enhanced template registry
|
|
When EReg: I check if a non-existent template exists in enhanced registry
|
|
Then EReg: the result should be false
|
|
|
|
Scenario: Test get_template_metadata from cache
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a cached template with metadata
|
|
When EReg: I get the template metadata
|
|
Then EReg: the metadata should include type and parameters
|
|
And EReg: the parameters should be properly formatted
|
|
|
|
Scenario: Test get_template_metadata from store
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have a template in store only with metadata
|
|
When EReg: I get the template metadata
|
|
Then EReg: the store metadata should be returned
|
|
|
|
Scenario: Test get_template_metadata not found
|
|
Given EReg: I create an enhanced template registry
|
|
When EReg: I try to get metadata for non-existent template
|
|
Then EReg: a ValueError should be raised for metadata not found
|
|
|
|
Scenario: Test list_templates for specific type
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have templates of different types
|
|
When EReg: I list templates for agent type
|
|
Then EReg: only agent template names should be returned
|
|
And EReg: duplicates should be removed
|
|
|
|
Scenario: Test list_templates for all types
|
|
Given EReg: I create an enhanced template registry
|
|
And EReg: I have templates of different types
|
|
When EReg: I list all templates
|
|
Then EReg: all template types should be included
|
|
And EReg: each type should have its template names
|
|
And EReg: duplicates should be removed from each type |