def _assert_search_record(self, search_content, part_result_content, print_content=False): content = search_record(self.userid, search_content) if print_content is True: print content self.assertNotEqual(content.find(part_result_content), -1)
def _response_code(msg): if msg['MsgType'] == 'voice': content = reply_voice(msg) return util._response_text_msg(msg, content) if msg['MsgType'] == 'image': content = reply_image(msg) return util._response_text_msg(msg, content) code = msg['Content'].lower().strip() if code.endswith("。"): code = code[:len("。")] if code == MSG.CODE_MUTE: return util._response_text_msg(msg, MSG.REPLY_MUTE) if code == MSG.CODE_MANUAL or code == MSG.CODE_MANUAL2 or code == MSG.CODE_MANUAL3: return util._response_text_msg(msg, MSG.REPLY_MANUAL) if code == MSG.CODE_MORE or code == MSG.CODE_MORE2: return util._response_text_msg(msg, MSG.REPLY_MANUAL_MORE) if code == MSG.CODE_MORE_MORE or code == MSG.CODE_MORE_MORE2: return util._response_text_msg(msg, MSG.REPLY_MANUAL_MORE_MORE) if code == MSG.CODE_HISTORY: userid = msg['FromUserName'] content = view_history(userid) url = "http://h.woojuu.cc/u/%s" % (userid) picurl = "" return util._response_single_picture_msg(msg, "消费历史", content, picurl, url) if code == MSG.CODE_QRCODE: return util._response_single_picture_msg( msg, "莴苣二维码", "扫扫二维码,添加莴苣微信公众号", "http://wechat.woojuu.cc/qrcode", "") if code.find(MSG.CODE_SEARCH) == 0 or code.find(MSG.CODE_SEARCH2) == 0 \ or code.find(MSG.CODE_SEARCH3) == 0: content = search_record(msg['FromUserName'], msg['Content']) return util._response_text_msg(msg, content) if code == MSG.CODE_DELETE: content = delete_last_record(msg['FromUserName']) return util._response_text_msg(msg, content) content = add_expense(msg['FromUserName'], msg['Content']) return util._response_text_msg(msg, content)
def _response_code(msg): if msg['MsgType'] == 'voice': content = reply_voice(msg) return util._response_text_msg(msg, content) if msg['MsgType'] == 'image': content = reply_image(msg) return util._response_text_msg(msg, content) code = msg['Content'].lower().strip() if code.endswith("。"): code = code[:len("。")] if code == MSG.CODE_MUTE: return util._response_text_msg(msg, MSG.REPLY_MUTE) if code == MSG.CODE_MANUAL or code == MSG.CODE_MANUAL2 or code == MSG.CODE_MANUAL3: return util._response_text_msg(msg, MSG.REPLY_MANUAL) if code == MSG.CODE_MORE or code == MSG.CODE_MORE2: return util._response_text_msg(msg, MSG.REPLY_MANUAL_MORE) if code == MSG.CODE_MORE_MORE or code == MSG.CODE_MORE_MORE2: return util._response_text_msg(msg, MSG.REPLY_MANUAL_MORE_MORE) if code == MSG.CODE_HISTORY: userid = msg['FromUserName'] content = view_history(userid) url = "http://h.woojuu.cc/u/%s" % (userid) picurl = "" return util._response_single_picture_msg(msg, "消费历史", content, picurl, url) if code == MSG.CODE_QRCODE: return util._response_single_picture_msg(msg, "莴苣二维码", "扫扫二维码,添加莴苣微信公众号", "http://wechat.woojuu.cc/qrcode", "") if code.find(MSG.CODE_SEARCH) == 0 or code.find(MSG.CODE_SEARCH2) == 0 \ or code.find(MSG.CODE_SEARCH3) == 0: content = search_record(msg['FromUserName'], msg['Content']) return util._response_text_msg(msg, content) if code == MSG.CODE_DELETE: content = delete_last_record(msg['FromUserName']) return util._response_text_msg(msg, content) content = add_expense(msg['FromUserName'], msg['Content']) return util._response_text_msg(msg, content)
def _assert_search_record(self, search_content, part_result_content, print_content = False): content = search_record(self.userid, search_content) if print_content is True: print content self.assertNotEqual(content.find(part_result_content), -1)