32
32
class TestWithoutConfig(tests.TestCaseWithTransport):
34
def test_no_config(self):
34
def test_config_all(self):
35
35
out, err = self.run_bzr(['config'])
36
36
self.assertEquals('', out)
37
37
self.assertEquals('', err)
39
def test_all_variables_no_config(self):
40
out, err = self.run_bzr(['config', '*'])
41
self.assertEquals('', out)
42
self.assertEquals('', err)
39
def test_remove_unknown_option(self):
40
self.run_bzr_error(['The "file" configuration option does not exist',],
41
['config', '--remove', 'file'])
43
def test_all_remove_exclusive(self):
44
self.run_bzr_error(['--all and --remove are mutually exclusive.',],
45
['config', '--remove', '--all'])
47
def test_all_set_exclusive(self):
48
self.run_bzr_error(['Only one option can be set.',],
49
['config', '--all', 'hello=world'])
51
def test_remove_no_option(self):
52
self.run_bzr_error(['--remove expects an option to remove.',],
53
['config', '--remove'])
44
55
def test_unknown_option(self):
45
56
self.run_bzr_error(['The "file" configuration option does not exist',],
46
['config', '--remove', 'file'])
59
def test_unexpected_regexp(self):
61
['The "\*file" configuration option does not exist',],
64
def test_wrong_regexp(self):
66
['Invalid pattern\(s\) found. "\*file" nothing to repeat',],
67
['config', '--all', '*file'])
48
71
class TestConfigDisplay(tests.TestCaseWithTransport):
51
74
super(TestConfigDisplay, self).setUp()
52
75
_t_config.create_configs(self)
77
def test_multiline_all_values(self):
78
self.bazaar_config.set_user_option('multiline', '1\n2\n')
79
# Fallout from bug 710410, the triple quotes have been toggled
80
script.run_script(self, '''\
88
def test_multiline_value_only(self):
89
self.bazaar_config.set_user_option('multiline', '1\n2\n')
90
# Fallout from bug 710410, the triple quotes have been toggled
91
script.run_script(self, '''\
92
$ bzr config -d tree multiline
98
def test_list_all_values(self):
99
self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
100
script.run_script(self, '''\
103
list = 1, a, "with, a comma"
106
def test_list_value_only(self):
107
self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
108
script.run_script(self, '''\
109
$ bzr config -d tree list
110
1, a, "with, a comma"
54
113
def test_bazaar_config(self):
55
114
self.bazaar_config.set_user_option('hello', 'world')
56
115
script.run_script(self, '''\
142
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
144
def test_location_with_policy(self):
145
# LocationConfig is the only one dealing with policies so far.
146
self.make_branch_and_tree('tree')
150
url:policy = appendpath
153
""" % {'dir': self.test_dir}
154
# We don't use the config directly so we save it to disk
155
config.LocationConfig.from_string(config_text, 'tree', save=True)
156
# policies are displayed with their options since they are part of
157
# their definition, likewise the path is not appended, we are just
158
# presenting the relevant portions of the config files
159
script.run_script(self, '''\
160
$ bzr config -d tree --all url
166
url:policy = appendpath
170
class TestConfigActive(tests.TestCaseWithTransport):
173
super(TestConfigActive, self).setUp()
174
_t_config.create_configs_with_file_option(self)
176
def test_active_in_locations(self):
177
script.run_script(self, '''\
178
$ bzr config -d tree file
182
def test_active_in_bazaar(self):
183
script.run_script(self, '''\
184
$ bzr config -d tree --scope bazaar file
188
def test_active_in_branch(self):
189
# We need to delete the locations definition that overrides the branch
191
script.run_script(self, '''\
192
$ bzr config -d tree --remove file
193
$ bzr config -d tree file
83
198
class TestConfigSetOption(tests.TestCaseWithTransport):
93
208
def test_bazaar_config_outside_branch(self):
94
209
script.run_script(self, '''\
95
210
$ bzr config --scope bazaar hello=world
96
$ bzr config -d tree hello
211
$ bzr config -d tree --all hello
101
216
def test_bazaar_config_inside_branch(self):
102
217
script.run_script(self, '''\
103
218
$ bzr config -d tree --scope bazaar hello=world
104
$ bzr config -d tree hello
219
$ bzr config -d tree --all hello
109
224
def test_locations_config_inside_branch(self):
110
225
script.run_script(self, '''\
111
226
$ bzr config -d tree --scope locations hello=world
112
$ bzr config -d tree hello
227
$ bzr config -d tree --all hello
117
233
def test_branch_config_default(self):
118
234
script.run_script(self, '''\
119
235
$ bzr config -d tree hello=world
120
$ bzr config -d tree hello
236
$ bzr config -d tree --all hello
125
241
def test_branch_config_forcing_branch(self):
126
242
script.run_script(self, '''\
127
243
$ bzr config -d tree --scope branch hello=world
128
$ bzr config -d tree hello
244
$ bzr config -d tree --all hello
144
260
def test_bazaar_config_outside_branch(self):
145
261
script.run_script(self, '''\
146
262
$ bzr config --scope bazaar --remove file
147
$ bzr config -d tree file
263
$ bzr config -d tree --all file
154
271
def test_bazaar_config_inside_branch(self):
155
272
script.run_script(self, '''\
156
273
$ bzr config -d tree --scope bazaar --remove file
157
$ bzr config -d tree file
274
$ bzr config -d tree --all file
164
282
def test_locations_config_inside_branch(self):
165
283
script.run_script(self, '''\
166
284
$ bzr config -d tree --scope locations --remove file
167
$ bzr config -d tree file
285
$ bzr config -d tree --all file
190
308
def test_branch_config_forcing_branch(self):
191
309
script.run_script(self, '''\
192
310
$ bzr config -d tree --scope branch --remove file
193
$ bzr config -d tree file
311
$ bzr config -d tree --all file
199
318
script.run_script(self, '''\
200
319
$ bzr config -d tree --remove file
201
$ bzr config -d tree file
320
$ bzr config -d tree --all file