Unit testing python vtk protocol

Hi,

I’m trying to unit test a protocol that returns a binary file.
I’m returning the file with a addAttachment and so far it’s working great with the front end.

But when I’m trying to unit test the python code all by itself, it doesn’t seem to behave the same way.
This is what I’m returning : return {"blob":self.addAttachment(file_content)}
The blob seems to be blocking the response, without the blob I get a result key in the response
Here is the response with the blob :
response={'wslink': '1.0', 'method': 'wslink.binary.attachment', 'args': ['wslink_bin2']}

From the wslink code I seem to understand that I need to call a specific rpc with the attachement id to get the file content, but I can’t figure out how.

Thanks in advance for your help,

1 Like

Found the solution, I had to call ws.recv() a second time to get the file

wslink comes with a JavaScript client that hide those protocols details.
Also the latest major version of wslink rely on msgpack which change the structure of those binary messages. If your testing apply at a too low level they will fail if you update the py/js library of wslink.