-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
|
||
def find_template_values( | ||
template_definition: dict, | ||
templated_values: dict = {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's generally not recommended to instantiate mutable objects like dictionaries or lists as default parameter values in Python function signatures. This is because mutable default values are evaluated only once when the function is defined, and subsequent calls to the function will reuse the same object, potentially leading to unintended behavior.
templated_values: dict = {}, | |
templated_values: Optional[dict] = None, |
from catalystwan.api.templates.device_variable import DeviceVariable | ||
|
||
|
||
def find_template_values( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The find_template_values function is integral to the UX2 transformation process. It's imperative to conduct thorough unit tests to ensure its reliability and accuracy. Testing should encompass both default Cisco models and fully populated models.
for template in self.templates: | ||
definition = template.template_definiton | ||
with self.subTest(template_name=template.name): | ||
parsed_values = find_template_values(definition) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Address the underlying issues causing the test function to fail for our demo vManage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider to write this as unit test to not rely on having fully configured vManage and speed up test execution. This will also be useful since github workflows only run unit tests. (For now)
ca08cfa
to
062d3d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request summary:
Adjustments to Feature Template deserialization, adding proper support for nested values and correct field names
Description of changes:
Checklist: