~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_config.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:37:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105103758-wzftnmsip5iv9n2g
Revert addition of get_message_encoding function

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Black-box tests for bzr config."""
19
19
 
20
 
import os
21
 
 
22
20
from bzrlib import (
23
21
    config,
24
 
    errors,
25
22
    tests,
26
23
    )
27
24
from bzrlib.tests import (
28
25
    script,
29
26
    test_config as _t_config,
30
27
    )
 
28
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
29
 
31
30
 
32
31
class TestWithoutConfig(tests.TestCaseWithTransport):
33
32
 
96
95
            ''')
97
96
 
98
97
    def test_list_all_values(self):
 
98
        # FIXME: we should register the option as a list or it's displayed as
 
99
        # astring and as such, quoted.
99
100
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
100
101
        script.run_script(self, '''\
101
102
            $ bzr config -d tree
102
103
            bazaar:
103
 
              list = 1, a, "with, a comma"
 
104
              list = '1, a, "with, a comma"'
104
105
            ''')
105
106
 
106
107
    def test_list_value_only(self):
 
108
        # FIXME: we should register the option as a list or it's displayed as
 
109
        # astring and as such, quoted.
107
110
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
108
111
        script.run_script(self, '''\
109
112
            $ bzr config -d tree list
110
 
            1, a, "with, a comma"
 
113
            '1, a, "with, a comma"'
111
114
            ''')
112
115
 
113
116
    def test_bazaar_config(self):
189
192
        # We need to delete the locations definition that overrides the branch
190
193
        # one
191
194
        script.run_script(self, '''\
192
 
            $ bzr config -d tree --remove file
 
195
            $ bzr config -d tree --scope locations --remove file
193
196
            $ bzr config -d tree file
194
197
            branch
195
198
            ''')
291
294
 
292
295
    def test_branch_config_default(self):
293
296
        script.run_script(self, '''\
294
 
            $ bzr config -d tree --remove file
 
297
            $ bzr config -d tree --scope locations --remove file
295
298
            $ bzr config -d tree --all file
296
299
            branch:
297
300
              file = branch
316
319
              file = bazaar
317
320
            ''')
318
321
        script.run_script(self, '''\
319
 
            $ bzr config -d tree --remove file
 
322
            $ bzr config -d tree --scope locations --remove file
320
323
            $ bzr config -d tree --all file
321
324
            bazaar:
322
325
              file = bazaar
323
326
            ''')
 
327
 
 
328
 
 
329
class TestSmartServerConfig(tests.TestCaseWithTransport):
 
330
 
 
331
    def test_simple_branch_config(self):
 
332
        self.setup_smart_server_with_call_log()
 
333
        t = self.make_branch_and_tree('branch')
 
334
        self.reset_smart_call_log()
 
335
        out, err = self.run_bzr(['config', '-d', self.get_url('branch')])
 
336
        # This figure represent the amount of work to perform this use case. It
 
337
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
338
        # being too low. If rpc_count increases, more network roundtrips have
 
339
        # become necessary for this use case. Please do not adjust this number
 
340
        # upwards without agreement from bzr's network support maintainers.
 
341
        self.assertLength(5, self.hpss_calls)
 
342
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)