def test_arena_battle(self): req = protomsg.ArenaRequest() req.session = self.session data = tests.pack_data(req) res = tests.make_request('/pvp/', data) msgs = tests.unpack_data(res)
def test_plunder_list(self): req = protomsg.PlunderListRequest() req.session = self.session data = tests.pack_data(req) res = tests.make_request('/plunder/list/', data) msgs = tests.unpack_data(res)
def test_plunder_battle(self): req = protomsg.PlunderRequest() req.session = self.session req.id = self.other_char_id data = tests.pack_data(req) res = tests.make_request('/plunder/', data) msgs = tests.unpack_data(res)
def test_get(self): req = protomsg.GetHeroRequest() req.session = self.session req.id = 1 data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/hero/get/', data) msgs = app_test_helper.unpack_data(res)
def test_get(self): req = protomsg.GetHeroRequest() req.session = self.session req.id = 1 data = app_test_helper.pack_data(req) res = app_test_helper.make_request("/hero/get/", data) msgs = app_test_helper.unpack_data(res)
def _cancel(self): req = protomsg.HangCancelRequest() req.session = self.session data = tests.pack_data(req) res = tests.make_request('/hang/cancel/', data) msgs = tests.unpack_data(res) return msgs
def _hang(self): req = protomsg.HangRequest() req.session = self.session req.stage_id = 1 data = tests.pack_data(req) res = tests.make_request('/hang/', data) msgs = tests.unpack_data(res) return msgs
def _cmd(self, action, tp, param): req = protomsg.TestRequest() req.session = self.session req.action = action req.tp = tp req.param = param data = tests.pack_data(req) res = tests.make_request('/test/', data) msgs = tests.unpack_data(res)
def _step_up(self, _id, ret=0): req = protomsg.StepUpEquipRequest() req.session = self.session req.id = _id data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/equip/stepup/', data) msgs = app_test_helper.unpack_data(res) for a, b, c in msgs: if a == protomsg.RESPONSE_NOTIFY_TYPE["StepUpEquipResponse"]: data = protomsg.StepUpEquipResponse() data.ParseFromString(c) self.assertEqual(data.ret, ret)
def _step_up(self, _id, ret=0): req = protomsg.HeroStepUpRequest() req.session = self.session req.id = _id data = app_test_helper.pack_data(req) res = app_test_helper.make_request("/hero/stepup/", data) msgs = app_test_helper.unpack_data(res) for id_of_msg, len_of_msg, msg in msgs: if id_of_msg == protomsg.RESPONSE_NOTIFY_TYPE["HeroStepUpResponse"]: data = protomsg.HeroStepUpResponse() data.ParseFromString(msg)
def _step_up(self, _id, ret=0): req = protomsg.HeroStepUpRequest() req.session = self.session req.id = _id data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/hero/stepup/', data) msgs = app_test_helper.unpack_data(res) for id_of_msg, len_of_msg, msg in msgs: if id_of_msg == protomsg.RESPONSE_NOTIFY_TYPE[ "HeroStepUpResponse"]: data = protomsg.HeroStepUpResponse() data.ParseFromString(msg)
def _pve(self, stage_id): req = protomsg.PVERequest() req.session = self.session req.stage_id = stage_id data = tests.pack_data(req) res = tests.make_request('/pve/', data) msgs = tests.unpack_data(res) for id_of_msg, len_of_msg, msg in msgs: if id_of_msg == RESPONSE_NOTIFY_TYPE["PVEResponse"]: data = protomsg.PVEResponse() data.ParseFromString(msg) self.assertEqual(data.stage_id, stage_id)
def _get_attach(self, mail_id, ret=0): req = protomsg.GetAttachmentRequest() req.session = self.session req.id = mail_id data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/mail/getattachment/', data) msgs = app_test_helper.unpack_data(res) for id_of_msg, len_of_msg, msg in msgs: if id_of_msg == protomsg.RESPONSE_NOTIFY_TYPE["GetAttachmentResponse"]: d = protomsg.GetAttachmentResponse() d.ParseFromString(msg) self.assertEqual(d.ret, ret)
def _open(self, mail_id, ret=0): req = protomsg.OpenMailRequest() req.session = self.session req.id = mail_id data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/mail/open/', data) msgs = app_test_helper.unpack_data(res) for id_of_msg, len_of_msg, msg in msgs: if id_of_msg == protomsg.RESPONSE_NOTIFY_TYPE["OpenMailResponse"]: d = protomsg.OpenMailResponse() d.ParseFromString(msg) self.assertEqual(d.ret, ret)
def _accept(self, _id, ret=0, session=None): if not session: session = self.session req = protomsg.FriendAcceptRequest() req.session = session req.id = _id data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/friend/accept/', data) msgs = app_test_helper.unpack_data(res) for id_of_msg, _, msg in msgs: if id_of_msg == RESPONSE_NOTIFY_TYPE['FriendAcceptResponse']: data = protomsg.FriendAcceptResponse() data.ParseFromString(msg) self.assertEqual(data.ret, ret)
def _set_socket(self, hero_id, weapon_id, armor_id, jewelry_id, ret): req = protomsg.SetSocketRequest() req.session = self.session req.socket.id = 1 req.socket.hero_id = hero_id req.socket.weapon_id = weapon_id req.socket.armor_id = armor_id req.socket.jewelry_id = jewelry_id data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/socket/set/', data) msgs = app_test_helper.unpack_data(res) for id_of_msg, len_of_msg, msg in msgs: if id_of_msg == RESPONSE_NOTIFY_TYPE["SetSocketResponse"]: data = protomsg.SetSocketResponse() data.ParseFromString(msg) self.assertEqual(data.ret, ret)
def _embed(self, equip_id, hole_id, gem_id, ret=0): if gem_id == 0: req = protomsg.UnEmbedGemRequest() url = '/equip/unembed/' response_name = "UnEmbedGemResponse" else: req = protomsg.EmbedGemRequest() req.gem_id = gem_id url = '/equip/embed/' response_name = "EmbedGemResponse" req.session = self.session req.equip_id = equip_id req.hole_id = hole_id data = app_test_helper.pack_data(req) res = app_test_helper.make_request(url, data) msgs = app_test_helper.unpack_data(res) for id_of_msg, _, msg in msgs: if id_of_msg == RESPONSE_NOTIFY_TYPE[response_name]: data = getattr(protomsg, response_name)() data.ParseFromString(msg) self.assertEqual(data.ret, ret)
def test_refresh(self): req = protomsg.GetHeroRefreshRequest() req.session = self.session data = app_test_helper.pack_data(req) res = app_test_helper.make_request("/heropanel/refresh/", data) msg = app_test_helper.unpack_data(res)
def test_refresh(self): req = protomsg.GetHeroRefreshRequest() req.session = self.session data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/heropanel/refresh/', data) msg = app_test_helper.unpack_data(res)
def test_player_list(self): req = protomsg.PlayerListRequest() req.session = self.session data = app_test_helper.pack_data(req) res = app_test_helper.make_request('/friend/player-list/', data) msgs = app_test_helper.unpack_data(res)