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)
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)
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)
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)
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)
def setUp(self): super(TestWithTransactionDatabase, self).setUp() self.tr.track(aProduct(name='one'))