Replace some of mock.patch with patch to reduce the indent level, also add some testings, code coverage: 78%