示例#1
0
文件: test_item.py 项目: bne/squeal
 def test_queryCheckpoint(self):
     """
     Test that a newly created Item is checkpointed before a query is
     executed.
     """
     store = Store()
     def txn():
         item = TestItem(store=store)
         list(store.query(TestItem))
         self.assertEquals(self.checkpointed, [item])
     store.transact(txn)
示例#2
0
 def test_queryCheckpoint(self):
     """
     Test that a newly created Item is checkpointed before a query is
     executed.
     """
     store = Store()
     def txn():
         item = TestItem(store=store)
         list(store.query(TestItem))
         self.assertEquals(self.checkpointed, [item])
     store.transact(txn)
示例#3
0
文件: test_item.py 项目: bne/squeal
    def test_transactionTouchCheckpoint(self):
        """
        Test that in a transaction an existing Item is checkpointed if it has
        touch called on it and the store it is in is checkpointed.
        """
        store = Store()
        item = TestItem(store=store)

        # Get rid of the entry that's there from creation
        self.checkpointed = []

        def txn():
            item.touch()
            store.checkpoint()
            self.assertEquals(self.checkpointed, [item])
        store.transact(txn)
示例#4
0
    def test_transactionTouchCheckpoint(self):
        """
        Test that in a transaction an existing Item is checkpointed if it has
        touch called on it and the store it is in is checkpointed.
        """
        store = Store()
        item = TestItem(store=store)

        # Get rid of the entry that's there from creation
        self.checkpointed = []

        def txn():
            item.touch()
            store.checkpoint()
            self.assertEquals(self.checkpointed, [item])
        store.transact(txn)
示例#5
0
文件: test_item.py 项目: bne/squeal
    def test_twoQueriesOneCheckpoint(self):
        """
        Test that if two queries are performed in a transaction, a touched item
        only has checkpoint called on it before the first.
        """
        store = Store()
        item = TestItem(store=store)

        # Get rid of the entry that's there from creation
        self.checkpointed = []

        def txn():
            item.touch()
            list(store.query(TestItem))
            self.assertEquals(self.checkpointed, [item])
            list(store.query(TestItem))
            self.assertEquals(self.checkpointed, [item])
        store.transact(txn)
示例#6
0
    def test_twoQueriesOneCheckpoint(self):
        """
        Test that if two queries are performed in a transaction, a touched item
        only has checkpoint called on it before the first.
        """
        store = Store()
        item = TestItem(store=store)

        # Get rid of the entry that's there from creation
        self.checkpointed = []

        def txn():
            item.touch()
            list(store.query(TestItem))
            self.assertEquals(self.checkpointed, [item])
            list(store.query(TestItem))
            self.assertEquals(self.checkpointed, [item])
        store.transact(txn)
示例#7
0
文件: test_item.py 项目: bne/squeal
 def test_transactionCheckpoint(self):
     """
     Test that an Item is checkpointed when the transaction it is created
     within is committed.
     """
     store = Store()
     def txn():
         item = TestItem(store=store)
         self.assertEquals(self.checkpointed, [])
         return item
     item = store.transact(txn)
     self.assertEquals(self.checkpointed, [item])
示例#8
0
 def test_transactionCheckpoint(self):
     """
     Test that an Item is checkpointed when the transaction it is created
     within is committed.
     """
     store = Store()
     def txn():
         item = TestItem(store=store)
         self.assertEquals(self.checkpointed, [])
         return item
     item = store.transact(txn)
     self.assertEquals(self.checkpointed, [item])