def test_listHiddenitem_success(self):
        result = InventoryUtil.listHiddenShopItem(guild_id=1)
        assert len(result) == 0

        ItemUtil.createItem(guild_id=1,
                            item_name="hello",
                            item_type=ItemType.ATTACK,
                            buff_type=BuffType.ATTACK,
                            buff_value=-1,
                            buff_round=2,
                            level_required=0,
                            price=1)
        ItemUtil.createItem(guild_id=1,
                            item_name="hey",
                            item_type=ItemType.STATUS,
                            buff_type=BuffType.DEFENCE,
                            buff_value=10,
                            buff_round=3,
                            level_required=0,
                            price=1)
        InventoryUtil.addItemToShop(guild_id=1, item_name="hello", amount=10)
        InventoryUtil.addItemToShop(guild_id=1, item_name="hey", amount=10)
        InventoryUtil.changeShopitemHiddenStatus(guild_id=1,
                                                 item_name="hello",
                                                 hidden=True)
        result = InventoryUtil.listHiddenShopItem(guild_id=1)
        assert len(result) == 1

        # items
        InventoryUtil.changeShopitemHiddenStatus(guild_id=1,
                                                 item_name="hey",
                                                 hidden=True)
        result = InventoryUtil.listHiddenShopItem(guild_id=1)
        assert len(result) == 2
Пример #2
0
 async def list_hidden_shopItem(self, ctx: commands.Command):
     result = InventoryUtil.listHiddenShopItem(ctx.guild.id)
     if len(result) < 1:
         await ctx.send("沒有任何商品隱藏")
     else:
         msg = "```\n"
         for product in result:
             msg += product.item.name + "\n"
         msg += "```"
         await ctx.send(msg)