Using Sinon Stubs

See the original posting on DZone Python

A few days ago, I wanted to test a JS function. Part of the test was to verify that another function gets called, and gets called correctly (with the correct parameters). I ended up using Sinon for the task, and now, looking back at it, it’s pretty easy and straightforward. The thing is, when I was trying to write my tests I didn’t find good examples and there was a little struggle until I figured it out, which is the motivation for this post (why not share and make someone’s else life easier, right?). 

So let’s go down to business!