Refactoring tests for charset

Added response factory as a parameter to patcher so that it returns
proxy response instead of a magic mock