Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
    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)
Пример #6
0
    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
Пример #7
0
    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
Пример #8
0
    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
Пример #9
0
    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
Пример #10
0
    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)
Пример #11
0
 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)
Пример #12
0
 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)
Пример #13
0
    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)
Пример #14
0
    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)
Пример #15
0
    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)
Пример #16
0
    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)
Пример #17
0
    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)
Пример #18
0
    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)
Пример #19
0
    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)
Пример #20
0
    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)
Пример #21
0
    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)
Пример #22
0
    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)
Пример #23
0
    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)
Пример #24
0
    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)
Пример #25
0
 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)
Пример #26
0
 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)
Пример #27
0
 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)
Пример #28
0
 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)