1332
1332
self.assertEqual('rejection message', err.msg)
1335
class TestBranchControlGetBranchConf(RemoteBranchTestCase):
1336
"""Getting the branch configuration should use an abstract method not vfs.
1335
class TestBranchGetSetConfig(RemoteBranchTestCase):
1339
1337
def test_get_branch_conf(self):
1340
# We should see that branch.get_config() does a single rpc to get the
1341
# remote configuration file, abstracting away where that is stored on
1342
# the server. However at the moment it always falls back to using the
1343
# vfs, and this would need some changes in config.py.
1345
1338
# in an empty branch we decode the response properly
1346
1339
client = FakeClient()
1347
1340
client.add_expected_call(
1357
1350
('call_expecting_body', 'Branch.get_config_file', ('memory:///',))],
1353
def test_set_option(self):
1354
client = FakeClient()
1355
client.add_expected_call(
1356
'Branch.get_stacked_on_url', ('memory:///',),
1357
'error', ('NotStacked',),)
1358
client.add_expected_call(
1359
'Branch.lock_write', ('memory:///', '', ''),
1360
'success', ('ok', 'branch token', 'repo token'))
1361
client.add_expected_call(
1362
'Branch.set_config_option', ('memory:///', 'branch token',
1363
'repo token', 'foo', 'bar', ''),
1365
client.add_expected_call(
1366
'Branch.unlock', ('memory:///', 'branch token', 'repo token'),
1368
transport = MemoryTransport()
1369
branch = self.make_remote_branch(transport, client)
1371
config = branch._get_config()
1372
config.set_option('foo', 'bar')
1374
client.finished_test()
1376
def test_backwards_compat_set_option(self):
1377
self.setup_smart_server_with_call_log()
1378
branch = self.make_branch('.')
1379
verb = 'Branch.set_config_option'
1380
self.disable_verb(verb)
1382
self.addCleanup(branch.unlock)
1383
self.reset_smart_call_log()
1384
branch._get_config().set_option('value', 'name')
1385
self.assertLength(10, self.hpss_calls)
1386
self.assertEqual('value', branch._get_config().get_option('name'))
1361
1389
class TestBranchLockWrite(RemoteBranchTestCase):