/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/test_remote.py

  • Committer: Andrew Bennetts
  • Date: 2008-05-14 12:29:11 UTC
  • mto: This revision was merged to the branch mainline in revision 3428.
  • Revision ID: andrew.bennetts@canonical.com-20080514122911-iha854lp35sa0n4m
Add some missing 'raise' statements to test_remote.

Show diffs side-by-side

added added

removed removed

Lines of Context:
616
616
            [('set_last_revision_info', 1234, 'a-revision-id')],
617
617
            real_branch.calls)
618
618
 
 
619
    def test_unexpected_error(self):
 
620
        # A response of 'NoSuchRevision' is translated into an exception.
 
621
        transport = MemoryTransport()
 
622
        transport.mkdir('branch')
 
623
        transport = transport.clone('branch')
 
624
        client = FakeClient(transport.base)
 
625
        # lock_write
 
626
        client.add_success_response('ok', 'branch token', 'repo token')
 
627
        # set_last_revision
 
628
        client.add_error_response('UnexpectedError')
 
629
        # unlock
 
630
        client.add_success_response('ok')
 
631
 
 
632
        bzrdir = RemoteBzrDir(transport, _client=False)
 
633
        branch = RemoteBranch(bzrdir, None, _client=client)
 
634
        # This is a hack to work around the problem that RemoteBranch currently
 
635
        # unnecessarily invokes _ensure_real upon a call to lock_write.
 
636
        branch._ensure_real = lambda: None
 
637
        # Lock the branch, reset the record of remote calls.
 
638
        branch.lock_write()
 
639
        client._calls = []
 
640
 
 
641
        err = self.assertRaises(
 
642
            errors.ErrorFromSmartServer,
 
643
            branch.set_last_revision_info, 123, 'revid')
 
644
        self.assertEqual(('UnexpectedError',), err.error_tuple)
 
645
        branch.unlock()
 
646
 
619
647
 
620
648
class TestBranchControlGetBranchConf(tests.TestCaseWithMemoryTransport):
621
649
    """Test branch.control_files api munging...
957
985
             ('sinhala/', revid))],
958
986
            client._calls)
959
987
 
 
988
    def test_unexpected_error(self):
 
989
        revid = '123'
 
990
        transport_path = 'sinhala'
 
991
        repo, client = self.setup_fake_client_and_repository(transport_path)
 
992
        client.add_error_response('AnUnexpectedError')
 
993
        e = self.assertRaises(errors.ErrorFromSmartServer,
 
994
            self.applyDeprecated, one_four, repo.get_revision_graph, revid)
 
995
        self.assertEqual(('AnUnexpectedError',), e.error_tuple)
 
996
 
960
997
        
961
998
class TestRepositoryIsShared(TestRemoteRepository):
962
999