~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_store.py

  • Committer: Aaron Bentley
  • Date: 2008-04-24 04:58:42 UTC
  • mfrom: (3377 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3380.
  • Revision ID: aaron@aaronbentley.com-20080424045842-0cajl9v6s4u52kaw
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
405
405
 
406
406
class TestVersionFileStore(TestCaseWithTransport):
407
407
 
 
408
    def get_scope(self):
 
409
        return self._transaction
 
410
 
408
411
    def setUp(self):
409
412
        super(TestVersionFileStore, self).setUp()
410
413
        self.vfstore = store.versioned.VersionedFileStore(MemoryTransport())
 
414
        self.vfstore.get_scope = self.get_scope
 
415
        self._transaction = None
411
416
 
412
417
    def test_get_weave_registers_dirty_in_write(self):
413
 
        transaction = transactions.WriteTransaction()
414
 
        vf = self.vfstore.get_weave_or_empty('id', transaction)
415
 
        transaction.finish()
416
 
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
417
 
        transaction = transactions.WriteTransaction()
418
 
        vf = self.vfstore.get_weave('id', transaction)
419
 
        transaction.finish()
420
 
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
421
 
 
422
 
    def test_get_weave_or_empty_readonly_fails(self):
423
 
        transaction = transactions.ReadOnlyTransaction()
424
 
        vf = self.assertRaises(errors.ReadOnlyError,
425
 
                               self.vfstore.get_weave_or_empty,
426
 
                               'id',
427
 
                               transaction)
 
418
        self._transaction = transactions.WriteTransaction()
 
419
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
 
420
        self._transaction.finish()
 
421
        self._transaction = None
 
422
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
 
423
        self._transaction = transactions.WriteTransaction()
 
424
        vf = self.vfstore.get_weave('id', self._transaction)
 
425
        self._transaction.finish()
 
426
        self._transaction = None
 
427
        self.assertRaises(errors.OutSideTransaction, vf.add_lines, 'b', [], [])
428
428
 
429
429
    def test_get_weave_readonly_cant_write(self):
430
 
        transaction = transactions.WriteTransaction()
431
 
        vf = self.vfstore.get_weave_or_empty('id', transaction)
432
 
        transaction.finish()
433
 
        transaction = transactions.ReadOnlyTransaction()
434
 
        vf = self.vfstore.get_weave_or_empty('id', transaction)
 
430
        self._transaction = transactions.WriteTransaction()
 
431
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
 
432
        self._transaction.finish()
 
433
        self._transaction = transactions.ReadOnlyTransaction()
 
434
        vf = self.vfstore.get_weave_or_empty('id', self._transaction)
435
435
        self.assertRaises(errors.ReadOnlyError, vf.add_lines, 'b', [], [])
436
436