adding inventories
This commit is contained in:
@@ -104,3 +104,9 @@ def bootstrap(db):
|
||||
|
||||
# persist all the records we've created
|
||||
db.add_or_update([foo, bar])
|
||||
|
||||
@pytest.fixture
|
||||
def carl(db, bootstrap):
|
||||
tiefling = db.Ancestry.filter_by(name="tiefling").one()
|
||||
carl = schema.Character(name="Carl", ancestry=tiefling)
|
||||
return carl
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
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
|
||||
Reference in New Issue
Block a user