tabletop-frog/test/test_inventories.py
2024-07-28 13:55:19 -07:00

17 lines
523 B
Python

from ttfrog.db.schema.item import Item, ItemType
def test_equipment_inventory(db, carl):
with db.transaction():
# trigger the creation of inventory mappings
db.add_or_update(carl)
# create an item
ten_foot_pole = Item(name="10ft. Pole", item_type=ItemType.ITEM, consumable=False)
db.add_or_update(ten_foot_pole)
# add the item to carl's inventory
carl.equipment.add(ten_foot_pole)
db.add_or_update(carl)
assert ten_foot_pole in carl.equipment