Unit Testing custom properties of a custom node

Hi,

I have created a custom node which runs python API's based on selected metadata. Custom Node is working as expected. However when I am trying to Unit Test this Node I am getting assertion error stating: "expected to have property "

Below is the test that I have written:

If I modify and run above Unit test, without specifying custom properties of my custom node, then the test passes. But for some reason it is not able to identify custom properties (custom_code_id & custom_code_def_name) in test.

Kindly help with this issue.

Regards

Does your node assign those properties to itself in its constructor function?

Just because a property exists in the config, it won't be automatically assigned to the node object.

Many Thanks @knolleary ... That was the issue. I was just using the field available from config within the custom nodes by assigning them to field variables. However that was happening inside "on('input')" ...just moved that part to constructor and initialized as a property ...voila... tests run fine now :smiley:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.