770
770
return OldSmartClient()
773
class RemoteBranchTestCase(TestRemote):
773
class RemoteBzrDirTestCase(TestRemote):
775
def make_remote_bzrdir(self, transport, client):
776
"""Make a RemotebzrDir using 'client' as the _client."""
777
return RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
781
class RemoteBranchTestCase(RemoteBzrDirTestCase):
775
783
def make_remote_branch(self, transport, client):
776
784
"""Make a RemoteBranch using 'client' as its _SmartClient.
781
789
# we do not want bzrdir to make any remote calls, so use False as its
782
790
# _client. If it tries to make a remote call, this will fail
784
bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
792
bzrdir = self.make_remote_bzrdir(transport, False)
786
793
repo = RemoteRepository(bzrdir, None, _client=client)
787
794
branch_format = self.get_branch_format()
788
795
format = RemoteBranchFormat(network_name=branch_format.network_name())
1419
1426
client.finished_test()
1429
class TestBzrDirGetSetConfig(RemoteBzrDirTestCase):
1431
def test__get_config(self):
1432
client = FakeClient()
1433
client.add_success_response_with_body('default_stack_on = /\n', 'ok')
1434
transport = MemoryTransport()
1435
bzrdir = self.make_remote_bzrdir(transport, client)
1436
config = bzrdir.get_config()
1437
self.assertEqual('/', config.get_default_stack_on())
1439
[('call_expecting_body', 'BzrDir.get_config_file', ('memory:///',))],
1442
def test_set_option_uses_vfs(self):
1443
self.setup_smart_server_with_call_log()
1444
bzrdir = self.make_bzrdir('.')
1445
verb = 'BzrDir.get_config_file'
1446
# self.disable_verb(verb)
1447
self.reset_smart_call_log()
1448
config = bzrdir.get_config()
1449
config.set_default_stack_on('/')
1450
self.assertLength(3, self.hpss_calls)
1452
def test_backwards_compat_get_option(self):
1453
self.setup_smart_server_with_call_log()
1454
bzrdir = self.make_bzrdir('.')
1455
verb = 'BzrDir.get_config_file'
1456
self.reset_smart_call_log()
1457
self.assertEqual(None,
1458
bzrdir._get_config().get_option('default_stack_on'))
1459
self.assertLength(3, self.hpss_calls)
1422
1462
class TestTransportIsReadonly(tests.TestCase):
1424
1464
def test_true(self):