Use mock instead of monkeypatch.