Adding mock to tests to avoid infinite recursion