Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on July 14, 2023 9:00PM
Likes: 0
Replies: 4
Hi,
Would someone suggest a way to mock dataiku.api_client().list_users(). I tried several different ways and none seems to be working.
Thanks
I am not sure I understand what exactly you are trying to do, can you please clarify?
Hi,
I have a method to get a list of users by calling dataiku.api_client().list_users() and process it. Now I would like to write a unit test for my processing logic, but does not require to test Dataiku's list_users method. What will be the best way to mock the list_users() method and in general any Dataiku's APIs?
Thanks
Personally I think you should not spend time on this. The Dataiku APIs are well understood, very solid and do not change that often. Specially with the list_users() API being read only and pretty simple. We have written a large amount of code using the Dataiku API and we barely see any issues, most of which are documented in the release notes. If you still want to test your API code I would suggest to write a regression pack which uses all the APIs you want to test and has expected inputs and outputs. Then run it against a live DSS instance running the version you want to test against.
That is exactly why I am trying to mock list_users. I am not writing unit test to test Dataiku's APIs, hence using mock to return expected values.