Пример #1
0
    def test_use_item_302(self):
        """测试两个box"""
        item_pb = ItemPB()
        item_pb.item_no = 1000112
        item_pb.item_num = 2
        game_resources_response_str = remoteservice.callTarget(
            302, 1, item_pb.SerializeToString())
        response = ItemUseResponse()
        response.ParseFromString(game_resources_response_str)
        self.assertEqual(response.res.result, True)
        self.assertEqual(response.gain.finance.coin, 2000)

        item = self.player.item_package.get_item(item_pb.item_no)
        self.assertEqual(item.num, 13)

        game_resources_response_str = remoteservice.callTarget(
            302, 1, item_pb.SerializeToString())
        response = ItemUseResponse()
        response.ParseFromString(game_resources_response_str)
        self.assertEqual(response.res.result, True)
        self.assertEqual(response.gain.finance.coin, 2000)

        item = self.player.item_package.get_item(item_pb.item_no)
        self.assertEqual(item.num, 11)

        item_pb = ItemPB()
        item_pb.item_no = 1000112
        item_pb.item_num = 10000
        game_resources_response_str = remoteservice.callTarget(
            302, 1, item_pb.SerializeToString())
        response = ItemUseResponse()
        response.ParseFromString(game_resources_response_str)
        self.assertEqual(response.res.result, False)
Пример #2
0
    def test_use_item_302(self):
        """测试两个box"""
        item_pb = ItemPB()
        item_pb.item_no = 1000112
        item_pb.item_num = 2
        game_resources_response_str = remoteservice.callTarget(302, 1, item_pb.SerializeToString())
        response = ItemUseResponse()
        response.ParseFromString(game_resources_response_str)
        self.assertEqual(response.res.result, True)
        self.assertEqual(response.gain.finance.coin, 2000)

        item = self.player.item_package.get_item(item_pb.item_no)
        self.assertEqual(item.num, 13)


        game_resources_response_str = remoteservice.callTarget(302, 1, item_pb.SerializeToString())
        response = ItemUseResponse()
        response.ParseFromString(game_resources_response_str)
        self.assertEqual(response.res.result, True)
        self.assertEqual(response.gain.finance.coin, 2000)

        item = self.player.item_package.get_item(item_pb.item_no)
        self.assertEqual(item.num, 11)

        item_pb = ItemPB()
        item_pb.item_no = 1000112
        item_pb.item_num = 10000
        game_resources_response_str = remoteservice.callTarget(302, 1, item_pb.SerializeToString())
        response = ItemUseResponse()
        response.ParseFromString(game_resources_response_str)
        self.assertEqual(response.res.result, False)
Пример #3
0
    def test_change_equipments_703(self):
        equipments = self.player.equipment_component.get_all()
        last_equipment_id = equipments[len(equipments)-1].base_info.id

        request = ChangeEquipmentsRequest()
        request.slot_no = 1
        request.no = 1
        request.equipment_id = last_equipment_id

        remoteservice.callTarget(703, 1, request.SerializeToString())

        line_up_component = self.player.line_up_component
        line_up_slot = line_up_component.line_up_slots[1]
Пример #4
0
    def test_init_login_gift_825(self):
        str_response = remoteservice.callTarget(825, 1, "")

        response = login_gift_pb2.LineUpResponse()
        response = login_gift_pb2.InitLoginGiftResponse()
        response.ParseFromString(str_response)
        print(response)
Пример #5
0
    def test_init_login_gift_825(self):
        str_response = remoteservice.callTarget(825, 1, "")

        response = login_gift_pb2.LineUpResponse()
        response = login_gift_pb2.InitLoginGiftResponse()
        response.ParseFromString(str_response)
        print(response)
Пример #6
0
 def test_get_items_301(self):
     """取得全部道具"""
     response_str = remoteservice.callTarget(301, 1)
     response = GetItemsResponse()
     response.ParseFromString(response_str)
     items = response.items
     self.assertEqual(len(items), 7, "%d_%d" % (len(items), 7))
     self.assertEqual(items[6].item_no, 1000113, "%d_%d" % (items[6].item_no, 1000113))
     self.assertEqual(items[6].item_num, 15, "%d_%d" % (items[6].item_num, 15))
Пример #7
0
    def test_compose_equipments(self):
        request = ComposeEquipmentRequest()
        request.no = 1000112

        str_response = remoteservice.callTarget(403, 1, request.SerializeToString())
        print str_response, "str_response"
        response = ComposeEquipmentResponse()
        response.ParseFromString(str_response)
        self.assertEqual(response.res.result, True)
        self.assertEqual(response.equ.no, 100001, "%d_%d" % (response.equ.no, 100001))
Пример #8
0
 def test_get_items_301(self):
     """取得全部道具"""
     response_str = remoteservice.callTarget(301, 1)
     response = GetItemsResponse()
     response.ParseFromString(response_str)
     items = response.items
     self.assertEqual(len(items), 7, "%d_%d" % (len(items), 7))
     self.assertEqual(items[6].item_no, 1000113,
                      "%d_%d" % (items[6].item_no, 1000113))
     self.assertEqual(items[6].item_num, 15,
                      "%d_%d" % (items[6].item_num, 15))
Пример #9
0
    def test_enhance_equipments(self):
        request = EnhanceEquipmentRequest()
        request.id = "001115"
        request.type = 1
        request.num = 1

        str_response = remoteservice.callTarget(402, 1, request.SerializeToString())
        response = EnhanceEquipmentResponse()
        response.ParseFromString(str_response)
        self.assertEqual(response.res.result, True)
        self.assertEqual(response.data[0].before_lv, 0, "%d_%d" % (response.data[0].before_lv, 0))
        self.assertEqual(response.data[0].after_lv, 1, "%d_%d" % (response.data[0].after_lv, 1))
        self.assertEqual(response.data[0].cost_coin, 16, "%d_%d" % (response.data[0].after_lv, 16))
Пример #10
0
    def test_change_hero_702(self):
        request = ChangeHeroRequest()
        request.hero_no = 10003
        request.slot_no = 1
        request.change_type = 1
        str_response = remoteservice.callTarget(702, 1, request.SerializeToString())

        response = line_up_pb2.LineUpResponse()
        response.ParseFromString(str_response)

        line_up_component = self.player.line_up_component
        line_up_slot = line_up_component.sub_slots[1]
        self.assertEqual(line_up_slot.hero_slot.hero_no, 10003, "%d_%d" % (line_up_slot.hero_slot.hero_no, 10003))
        self.assertEqual(response.sub[0].hero.hero_no, 10003, "%d_%d" % (response.sub[0].hero.hero_no, 10003))