コード例 #1
0
 def testDoubleTrackFails(self):
     """
     If you try tracking an object in two different transactions,
     you'll find that you can't.
     """
     p = aProduct()
     self.tr.track(p)
     self.assertRaises(ValueError, self.other_tr.track, p)
コード例 #2
0
 def testDoubleTrackFails(self):
     """
     If you try tracking an object in two different transactions,
     you'll find that you can't.
     """
     p = aProduct()
     self.tr.track(p)
     self.assertRaises(ValueError, self.other_tr.track, p)
コード例 #3
0
 def testTrack(self):
     """
     Try to create an object, specifying the transaction against
     which you're working.
     """
     p = aProduct()
     self.tr.track(p)
     self.assertEqual(len(self.tr.tracked), 1)
コード例 #4
0
 def testTrack(self):
     """
     Try to create an object, specifying the transaction against
     which you're working.
     """
     p = aProduct()
     self.tr.track(p)
     self.assertEqual(len(self.tr.tracked), 1)
コード例 #5
0
 def testDoubleTrackSameTranOk(self):
     """
     However, if you try tracking an object twice on the same
     transaction, you're ok.
     """
     p = aProduct()
     self.tr.track(p)
     self.tr.track(p)
     self.assertEqual(len(self.tr.tracked), 1)
コード例 #6
0
 def testDoubleTrackSameTranOk(self):
     """
     However, if you try tracking an object twice on the same
     transaction, you're ok.
     """
     p = aProduct()
     self.tr.track(p)
     self.tr.track(p)
     self.assertEqual(len(self.tr.tracked), 1)
コード例 #7
0
 def testMultipleTrack(self):
     """
     Try to create several objects, specifying the transaction against
     which you're working.
     """
     p=[]
     for i in xrange(10):
         p.append(aProduct())
     self.tr.track(*p)
     self.assertEqual(len(self.tr.tracked), 10)
コード例 #8
0
 def testMultipleTrack(self):
     """
     Try to create several objects, specifying the transaction against
     which you're working.
     """
     p = []
     for i in xrange(10):
         p.append(aProduct())
     self.tr.track(*p)
     self.assertEqual(len(self.tr.tracked), 10)
コード例 #9
0
 def setUp(self):
     super(TestWithTransactionDatabase, self).setUp()
     self.tr.track(aProduct(name='one'))
コード例 #10
0
 def setUp(self):
     super(TestWithTransactionDatabase, self).setUp()
     self.tr.track(aProduct(name='one'))