/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
        self.assertEqual('-----BEGIN PSEUDO-SIGNED CONTENT-----\n' +
323
323
                         Testament.from_revision(branch.repository,
324
324
                         'A').as_short_text() +
325
 
                         '-----END PSUDO-SIGNED CONTENT-----\n',
 
325
                         '-----END PSEUDO-SIGNED CONTENT-----\n',
326
326
                         branch.repository.get_signature_text('A'))
327
327
 
328
328
    def test_store_signature(self):
335
335
                          'A')
336
336
        wt.commit("base", allow_pointless=True, rev_id='A')
337
337
        self.assertEqual('-----BEGIN PSEUDO-SIGNED CONTENT-----\n'
338
 
                         'FOO-----END PSUDO-SIGNED CONTENT-----\n',
 
338
                         'FOO-----END PSEUDO-SIGNED CONTENT-----\n',
339
339
                         branch.repository.get_signature_text('A'))
340
340
 
341
341
    def test_branch_keeps_signatures(self):
595
595
        self.assertEqual(['lw', 'ul'], branch._calls)
596
596
 
597
597
 
598
 
class TestBranchTransaction(TestCaseWithBranch):
599
 
 
600
 
    def setUp(self):
601
 
        super(TestBranchTransaction, self).setUp()
602
 
        self.branch = None
603
 
        
604
 
    def test_default_get_transaction(self):
605
 
        """branch.get_transaction on a new branch should give a PassThrough."""
606
 
        self.failUnless(isinstance(self.get_branch().get_transaction(),
607
 
                                   transactions.PassThroughTransaction))
608
 
 
609
 
    def test__set_new_transaction(self):
610
 
        self.get_branch()._set_transaction(transactions.ReadOnlyTransaction())
611
 
 
612
 
    def test__set_over_existing_transaction_raises(self):
613
 
        self.get_branch()._set_transaction(transactions.ReadOnlyTransaction())
614
 
        self.assertRaises(errors.LockError,
615
 
                          self.get_branch()._set_transaction,
616
 
                          transactions.ReadOnlyTransaction())
617
 
 
618
 
    def test_finish_no_transaction_raises(self):
619
 
        self.assertRaises(errors.LockError, self.get_branch()._finish_transaction)
620
 
 
621
 
    def test_finish_readonly_transaction_works(self):
622
 
        self.get_branch()._set_transaction(transactions.ReadOnlyTransaction())
623
 
        self.get_branch()._finish_transaction()
624
 
        self.assertEqual(None, self.get_branch().control_files._transaction)
625
 
 
626
 
    def test_unlock_calls_finish(self):
627
 
        self.get_branch().lock_read()
628
 
        transaction = InstrumentedTransaction()
629
 
        self.get_branch().control_files._transaction = transaction
630
 
        self.get_branch().unlock()
631
 
        self.assertEqual(['finish'], transaction.calls)
632
 
 
633
 
    def test_lock_read_acquires_ro_transaction(self):
634
 
        self.get_branch().lock_read()
635
 
        self.failUnless(isinstance(self.get_branch().get_transaction(),
636
 
                                   transactions.ReadOnlyTransaction))
637
 
        self.get_branch().unlock()
638
 
        
639
 
    def test_lock_write_acquires_write_transaction(self):
640
 
        self.get_branch().lock_write()
641
 
        # cannot use get_transaction as its magic
642
 
        self.failUnless(isinstance(self.get_branch().control_files._transaction,
643
 
                                   transactions.WriteTransaction))
644
 
        self.get_branch().unlock()
645
 
 
646
 
 
647
598
class TestBranchPushLocations(TestCaseWithBranch):
648
599
 
649
600
    def test_get_push_location_unset(self):