~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

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
 
20
22
from bzrlib import (
21
23
    config,
 
24
    errors,
22
25
    tests,
23
26
    )
24
27
from bzrlib.tests import (
25
28
    script,
26
29
    test_config as _t_config,
27
30
    )
28
 
from bzrlib.tests.matchers import ContainsNoVfsCalls
29
 
 
30
31
 
31
32
class TestWithoutConfig(tests.TestCaseWithTransport):
32
33
 
79
80
        script.run_script(self, '''\
80
81
            $ bzr config -d tree
81
82
            bazaar:
82
 
              [DEFAULT]
83
83
              multiline = """1
84
84
            2
85
85
            """
96
96
            ''')
97
97
 
98
98
    def test_list_all_values(self):
99
 
        config.option_registry.register(config.ListOption('list'))
100
 
        self.addCleanup(config.option_registry.remove, 'list')
101
99
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
102
100
        script.run_script(self, '''\
103
101
            $ bzr config -d tree
104
102
            bazaar:
105
 
              [DEFAULT]
106
103
              list = 1, a, "with, a comma"
107
104
            ''')
108
105
 
109
106
    def test_list_value_only(self):
110
 
        config.option_registry.register(config.ListOption('list'))
111
 
        self.addCleanup(config.option_registry.remove, 'list')
112
107
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
113
108
        script.run_script(self, '''\
114
109
            $ bzr config -d tree list
120
115
        script.run_script(self, '''\
121
116
            $ bzr config -d tree
122
117
            bazaar:
123
 
              [DEFAULT]
124
118
              hello = world
125
119
            ''')
126
120
 
142
136
        script.run_script(self, '''\
143
137
            $ bzr config
144
138
            bazaar:
145
 
              [DEFAULT]
146
 
              hello = world
147
 
            ''')
148
 
 
149
 
    def test_cmd_line(self):
150
 
        self.bazaar_config.set_user_option('hello', 'world')
151
 
        script.run_script(self, '''\
152
 
            $ bzr config -Ohello=bzr
153
 
            cmdline:
154
 
              hello = bzr
155
 
            bazaar:
156
 
              [DEFAULT]
157
 
              hello = world
158
 
            ''')
159
 
 
 
139
              hello = world
 
140
            ''')
160
141
 
161
142
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
162
143
 
208
189
        # We need to delete the locations definition that overrides the branch
209
190
        # one
210
191
        script.run_script(self, '''\
211
 
            $ bzr config -d tree --scope locations --remove file
 
192
            $ bzr config -d tree --remove file
212
193
            $ bzr config -d tree file
213
194
            branch
214
195
            ''')
229
210
            $ bzr config --scope bazaar hello=world
230
211
            $ bzr config -d tree --all hello
231
212
            bazaar:
232
 
              [DEFAULT]
233
213
              hello = world
234
214
            ''')
235
215
 
238
218
            $ bzr config -d tree --scope bazaar hello=world
239
219
            $ bzr config -d tree --all hello
240
220
            bazaar:
241
 
              [DEFAULT]
242
221
              hello = world
243
222
            ''')
244
223
 
307
286
            branch:
308
287
              file = branch
309
288
            bazaar:
310
 
              [DEFAULT]
311
289
              file = bazaar
312
290
            ''')
313
291
 
314
292
    def test_branch_config_default(self):
315
293
        script.run_script(self, '''\
316
 
            $ bzr config -d tree --scope locations --remove file
 
294
            $ bzr config -d tree --remove file
317
295
            $ bzr config -d tree --all file
318
296
            branch:
319
297
              file = branch
320
298
            bazaar:
321
 
              [DEFAULT]
322
299
              file = bazaar
323
300
            ''')
324
301
        script.run_script(self, '''\
325
302
            $ bzr config -d tree --remove file
326
303
            $ bzr config -d tree --all file
327
304
            bazaar:
328
 
              [DEFAULT]
329
305
              file = bazaar
330
306
            ''')
331
307
 
337
313
              [.../work/tree]
338
314
              file = locations
339
315
            bazaar:
340
 
              [DEFAULT]
341
316
              file = bazaar
342
317
            ''')
343
318
        script.run_script(self, '''\
344
 
            $ bzr config -d tree --scope locations --remove file
 
319
            $ bzr config -d tree --remove file
345
320
            $ bzr config -d tree --all file
346
321
            bazaar:
347
 
              [DEFAULT]
348
322
              file = bazaar
349
323
            ''')
350
 
 
351
 
 
352
 
class TestSmartServerConfig(tests.TestCaseWithTransport):
353
 
 
354
 
    def test_simple_branch_config(self):
355
 
        self.setup_smart_server_with_call_log()
356
 
        t = self.make_branch_and_tree('branch')
357
 
        self.reset_smart_call_log()
358
 
        out, err = self.run_bzr(['config', '-d', self.get_url('branch')])
359
 
        # This figure represent the amount of work to perform this use case. It
360
 
        # is entirely ok to reduce this number if a test fails due to rpc_count
361
 
        # being too low. If rpc_count increases, more network roundtrips have
362
 
        # become necessary for this use case. Please do not adjust this number
363
 
        # upwards without agreement from bzr's network support maintainers.
364
 
        self.assertLength(5, self.hpss_calls)
365
 
        self.assertLength(1, self.hpss_connections)
366
 
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)