616
616
[('set_last_revision_info', 1234, 'a-revision-id')],
617
617
real_branch.calls)
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)
626
client.add_success_response('ok', 'branch token', 'repo token')
628
client.add_error_response('UnexpectedError')
630
client.add_success_response('ok')
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.
641
err = self.assertRaises(
642
errors.ErrorFromSmartServer,
643
branch.set_last_revision_info, 123, 'revid')
644
self.assertEqual(('UnexpectedError',), err.error_tuple)
620
648
class TestBranchControlGetBranchConf(tests.TestCaseWithMemoryTransport):
621
649
"""Test branch.control_files api munging...
957
985
('sinhala/', revid))],
988
def test_unexpected_error(self):
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)
961
998
class TestRepositoryIsShared(TestRemoteRepository):