Added encoding attribute to mock to fix tests