Use Sinon.js sandboxing to auto-restore things.