replace Deprecated method; use unittest.mock when available