def test_get_property_id(self): p = PropertyManager(db) assert p.get_property_id("/type/object", "title") is None pid = p.get_property_id("/type/object", "title", create=True) assert pid is not None assert p.get_property_id("/type/object", "title") == pid assert p.get_property_id("/type/object", "title", create=True) == pid
def test_rollback(self): # cache is not invalidated on rollback. This test confirms that behavior. tx = db.transaction() p = PropertyManager(db) pid = p.get_property_id("/type/object", "title", create=True) tx.rollback() assert p.get_property_id("/type/object", "title") == pid
def __init__(self, db, schema): self.db = db self.schema = schema self.sitename = None self.indexer = Indexer() self.store = store.Store(self.db) self.seq = sequence.SequenceImpl(self.db) self.cache = None self.property_manager = PropertyManager(self.db)
def test_copy(self): p = PropertyManager(db) pid = p.get_property_id("/type/object", "title", create=True) # copy should inherit the cache p2 = p.copy() assert p2.get_property_id("/type/object", "title") == pid # changes to the cache of the copy shouldn't affect the source. tx = db.transaction() p2.get_property_id("/type/object", "title2", create=True) tx.rollback() assert p.get_property_id("/type/object", "title2") is None