805
class TestSmartServerBranchRequestSetConfigOptionDict(TestLockedBranch):
808
TestLockedBranch.setUp(self)
809
# A dict with non-ascii keys and values to exercise unicode
811
self.encoded_value_dict = (
812
'd5:ascii1:a11:unicode \xe2\x8c\x9a3:\xe2\x80\xbde')
814
'ascii': 'a', u'unicode \N{WATCH}': u'\N{INTERROBANG}'}
816
def test_value_name(self):
817
branch = self.make_branch('.')
818
request = smart_branch.SmartServerBranchRequestSetConfigOptionDict(
819
branch.bzrdir.root_transport)
820
branch_token, repo_token = self.get_lock_tokens(branch)
821
config = branch._get_config()
822
result = request.execute('', branch_token, repo_token,
823
self.encoded_value_dict, 'foo', '')
824
self.assertEqual(smart_req.SuccessfulSmartServerResponse(()), result)
825
self.assertEqual(self.value_dict, config.get_option('foo'))
829
def test_value_name_section(self):
830
branch = self.make_branch('.')
831
request = smart_branch.SmartServerBranchRequestSetConfigOptionDict(
832
branch.bzrdir.root_transport)
833
branch_token, repo_token = self.get_lock_tokens(branch)
834
config = branch._get_config()
835
result = request.execute('', branch_token, repo_token,
836
self.encoded_value_dict, 'foo', 'gam')
837
self.assertEqual(smart_req.SuccessfulSmartServerResponse(()), result)
838
self.assertEqual(self.value_dict, config.get_option('foo', 'gam'))
805
843
class TestSmartServerBranchRequestSetTagsBytes(TestLockedBranch):
806
844
# Only called when the branch format and tags match [yay factory
807
845
# methods] so only need to test straight forward cases.