164 lines
7.8 KiB
Gherkin
164 lines
7.8 KiB
Gherkin
Feature: Graph Templates Module Coverage
|
|
As a developer
|
|
I want to test all functionality in the graph templates module
|
|
So that we achieve 90%+ code coverage for the graph_templates.py file
|
|
|
|
Background:
|
|
Given I have a clean test environment for graph templates
|
|
|
|
# GraphTemplate class instantiate method tests
|
|
Scenario: Test GraphTemplate instantiate - basic graph configuration
|
|
Given I have a graph template registry
|
|
And I have a basic graph template
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the graph configuration should be returned
|
|
And the parameters section should be removed from graph config
|
|
And template variables should be applied to the graph config
|
|
And the result should have correct graph structure
|
|
|
|
Scenario: Test GraphTemplate instantiate - parameter validation
|
|
Given I have a graph template registry
|
|
And I have a graph template with required parameters
|
|
And I have valid template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then parameter validation should be called for graph templates
|
|
And the filled parameters should be used for graph templates
|
|
|
|
Scenario: Test GraphTemplate instantiate - template variable application
|
|
Given I have a graph template registry
|
|
And I have a graph template with template variables
|
|
And I have template parameters with variable values for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then template variables should be replaced with parameter values in graph config
|
|
|
|
Scenario: Test GraphTemplate instantiate - deep copy behavior
|
|
Given I have a graph template registry
|
|
And I have a graph template for deep copy test
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the original definition should not be modified for graph templates
|
|
And the returned config should be a separate copy for graph templates
|
|
|
|
Scenario: Test GraphTemplate instantiate - name assignment
|
|
Given I have a graph template registry
|
|
And I have a graph template without name
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the graph name should be assigned from template name
|
|
|
|
# Node processing tests
|
|
Scenario: Test GraphTemplate _process_nodes - basic node processing
|
|
Given I have a graph template registry
|
|
And I have a graph template with nodes
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then nodes should be processed correctly
|
|
And non-agent nodes should pass through unchanged
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - None node filtering
|
|
Given I have a graph template registry
|
|
And I have a graph template with None nodes
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then None nodes should be filtered out
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - agent node parameter reference
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using parameter references
|
|
And I have template parameters with agent references
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then agent parameter references should be resolved
|
|
And agent nodes should use resolved parameter values
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - agent node component reference
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using component references
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context with registered agents for graph templates
|
|
When I instantiate the graph template
|
|
Then agent component references should be resolved
|
|
And agent_config should be stored for resolved agents
|
|
And debug logging should be called for resolved references
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - agent reference resolution failure
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using invalid references
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then invalid agent references should be handled gracefully
|
|
And agent nodes should retain original reference
|
|
|
|
Scenario: Test GraphTemplate _process_nodes - template variable agent references
|
|
Given I have a graph template registry
|
|
And I have a graph template with agent nodes using template variables
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then template variable agent references should be preserved
|
|
And template variables should not be resolved as components
|
|
|
|
# Edge processing tests
|
|
Scenario: Test GraphTemplate _process_edges - basic edge processing
|
|
Given I have a graph template registry
|
|
And I have a graph template with edges
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then edges should be processed correctly
|
|
And all valid edges should be included
|
|
|
|
Scenario: Test GraphTemplate _process_edges - None edge filtering
|
|
Given I have a graph template registry
|
|
And I have a graph template with None edges
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then None edges should be filtered out
|
|
|
|
Scenario: Test GraphTemplate _process_edges - edge condition processing
|
|
Given I have a graph template registry
|
|
And I have a graph template with edges containing conditions
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then edge conditions should be processed with template variables
|
|
And template variables in conditions should be replaced
|
|
|
|
Scenario: Test GraphTemplate _process_edges - edges without conditions
|
|
Given I have a graph template registry
|
|
And I have a graph template with edges without conditions
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then edges without conditions should pass through unchanged
|
|
|
|
# Integration tests
|
|
Scenario: Test GraphTemplate instantiate - complete graph with nodes and edges
|
|
Given I have a graph template registry
|
|
And I have a complete graph template with nodes and edges
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the complete graph should be properly instantiated
|
|
And all nodes should be processed
|
|
And all edges should be processed
|
|
And the graph should have proper structure
|
|
|
|
Scenario: Test GraphTemplate instantiate - empty graph
|
|
Given I have a graph template registry
|
|
And I have an empty graph template
|
|
And I have template parameters for graph templates
|
|
And I have an instantiation context for graph templates
|
|
When I instantiate the graph template
|
|
Then the empty graph should be handled correctly
|
|
And basic graph structure should be maintained |