1652
1652
branch.unlock()
1653
1653
self.assertFinished(client)
1655
def test_set_option_with_dict(self):
1656
client = FakeClient()
1657
client.add_expected_call(
1658
'Branch.get_stacked_on_url', ('memory:///',),
1659
'error', ('NotStacked',),)
1660
client.add_expected_call(
1661
'Branch.lock_write', ('memory:///', '', ''),
1662
'success', ('ok', 'branch token', 'repo token'))
1663
encoded_dict_value = 'd5:ascii1:a11:unicode \xe2\x8c\x9a3:\xe2\x80\xbde'
1664
client.add_expected_call(
1665
'Branch.set_config_option_dict', ('memory:///', 'branch token',
1666
'repo token', encoded_dict_value, 'foo', ''),
1668
client.add_expected_call(
1669
'Branch.unlock', ('memory:///', 'branch token', 'repo token'),
1671
transport = MemoryTransport()
1672
branch = self.make_remote_branch(transport, client)
1674
config = branch._get_config()
1676
{'ascii': 'a', u'unicode \N{WATCH}': u'\N{INTERROBANG}'},
1679
self.assertFinished(client)
1655
1681
def test_backwards_compat_set_option(self):
1656
1682
self.setup_smart_server_with_call_log()
1657
1683
branch = self.make_branch('.')
1664
1690
self.assertLength(10, self.hpss_calls)
1665
1691
self.assertEqual('value', branch._get_config().get_option('name'))
1693
def test_backwards_compat_set_option_with_dict(self):
1694
self.setup_smart_server_with_call_log()
1695
branch = self.make_branch('.')
1696
verb = 'Branch.set_config_option_dict'
1697
self.disable_verb(verb)
1699
self.addCleanup(branch.unlock)
1700
self.reset_smart_call_log()
1701
config = branch._get_config()
1702
value_dict = {'ascii': 'a', u'unicode \N{WATCH}': u'\N{INTERROBANG}'}
1703
config.set_option(value_dict, 'name')
1704
self.assertLength(10, self.hpss_calls)
1705
self.assertEqual(value_dict, branch._get_config().get_option('name'))
1668
1708
class TestBranchLockWrite(RemoteBranchTestCase):