~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-01-06 22:44:57 UTC
  • mfrom: (6436 +trunk)
  • mto: (6437.3.11 2.5)
  • mto: This revision was merged to the branch mainline in revision 6444.
  • Revision ID: jelmer@samba.org-20120106224457-re0pcy0fz31xob77
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    script,
26
26
    test_config as _t_config,
27
27
    )
 
28
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
29
 
28
30
 
29
31
class TestWithoutConfig(tests.TestCaseWithTransport):
30
32
 
77
79
        script.run_script(self, '''\
78
80
            $ bzr config -d tree
79
81
            bazaar:
 
82
              [DEFAULT]
80
83
              multiline = """1
81
84
            2
82
85
            """
93
96
            ''')
94
97
 
95
98
    def test_list_all_values(self):
96
 
        # FIXME: we should register the option as a list or it's displayed as
97
 
        # astring and as such, quoted.
 
99
        config.option_registry.register(config.ListOption('list'))
 
100
        self.addCleanup(config.option_registry.remove, 'list')
98
101
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
99
102
        script.run_script(self, '''\
100
103
            $ bzr config -d tree
101
104
            bazaar:
102
 
              list = '1, a, "with, a comma"'
 
105
              [DEFAULT]
 
106
              list = 1, a, "with, a comma"
103
107
            ''')
104
108
 
105
109
    def test_list_value_only(self):
106
 
        # FIXME: we should register the option as a list or it's displayed as
107
 
        # astring and as such, quoted.
 
110
        config.option_registry.register(config.ListOption('list'))
 
111
        self.addCleanup(config.option_registry.remove, 'list')
108
112
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
109
113
        script.run_script(self, '''\
110
114
            $ bzr config -d tree list
111
 
            '1, a, "with, a comma"'
 
115
            1, a, "with, a comma"
112
116
            ''')
113
117
 
114
118
    def test_bazaar_config(self):
116
120
        script.run_script(self, '''\
117
121
            $ bzr config -d tree
118
122
            bazaar:
 
123
              [DEFAULT]
119
124
              hello = world
120
125
            ''')
121
126
 
137
142
        script.run_script(self, '''\
138
143
            $ bzr config
139
144
            bazaar:
140
 
              hello = world
141
 
            ''')
 
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
 
142
160
 
143
161
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
144
162
 
211
229
            $ bzr config --scope bazaar hello=world
212
230
            $ bzr config -d tree --all hello
213
231
            bazaar:
 
232
              [DEFAULT]
214
233
              hello = world
215
234
            ''')
216
235
 
219
238
            $ bzr config -d tree --scope bazaar hello=world
220
239
            $ bzr config -d tree --all hello
221
240
            bazaar:
 
241
              [DEFAULT]
222
242
              hello = world
223
243
            ''')
224
244
 
287
307
            branch:
288
308
              file = branch
289
309
            bazaar:
 
310
              [DEFAULT]
290
311
              file = bazaar
291
312
            ''')
292
313
 
297
318
            branch:
298
319
              file = branch
299
320
            bazaar:
 
321
              [DEFAULT]
300
322
              file = bazaar
301
323
            ''')
302
324
        script.run_script(self, '''\
303
325
            $ bzr config -d tree --remove file
304
326
            $ bzr config -d tree --all file
305
327
            bazaar:
 
328
              [DEFAULT]
306
329
              file = bazaar
307
330
            ''')
308
331
 
314
337
              [.../work/tree]
315
338
              file = locations
316
339
            bazaar:
 
340
              [DEFAULT]
317
341
              file = bazaar
318
342
            ''')
319
343
        script.run_script(self, '''\
320
344
            $ bzr config -d tree --scope locations --remove file
321
345
            $ bzr config -d tree --all file
322
346
            bazaar:
 
347
              [DEFAULT]
323
348
              file = bazaar
324
349
            ''')
325
350
 
337
362
        # become necessary for this use case. Please do not adjust this number
338
363
        # upwards without agreement from bzr's network support maintainers.
339
364
        self.assertLength(5, self.hpss_calls)
 
365
        self.assertLength(1, self.hpss_connections)
 
366
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)