I'm quite sure we can do better using sinon in tests, but let's keep this right now, I want to land this patch, we'll make it better later ;)