1
# Copyright (C) 2010 Canonical Ltd
1
# Copyright (C) 2010, 2011, 2012, 2016 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
26
26
test_config as _t_config,
28
from bzrlib.tests.matchers import ContainsNoVfsCalls
29
31
class TestWithoutConfig(tests.TestCaseWithTransport):
31
33
def test_config_all(self):
32
34
out, err = self.run_bzr(['config'])
33
self.assertEquals('', out)
34
self.assertEquals('', err)
35
self.assertEqual('', out)
36
self.assertEqual('', err)
36
38
def test_remove_unknown_option(self):
37
39
self.run_bzr_error(['The "file" configuration option does not exist',],
95
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.
98
def test_list_value_all(self):
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
102
list = '1, a, "with, a comma"'
106
list = 1, a, "with, a comma"
105
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.
109
def test_list_value_one(self):
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"
118
def test_registry_value_all(self):
119
self.bazaar_config.set_user_option('bzr.transform.orphan_policy',
121
script.run_script(self, '''\
125
bzr.transform.orphan_policy = move
128
def test_registry_value_one(self):
129
self.bazaar_config.set_user_option('bzr.transform.orphan_policy',
131
script.run_script(self, '''\
132
$ bzr config -d tree bzr.transform.orphan_policy
114
136
def test_bazaar_config(self):
137
160
script.run_script(self, '''\
167
def test_cmd_line(self):
168
self.bazaar_config.set_user_option('hello', 'world')
169
script.run_script(self, '''\
170
$ bzr config -Ohello=bzr
143
179
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
337
380
# become necessary for this use case. Please do not adjust this number
338
381
# upwards without agreement from bzr's network support maintainers.
339
382
self.assertLength(5, self.hpss_calls)
383
self.assertLength(1, self.hpss_connections)
384
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
387
class TestConfigDirectory(tests.TestCaseWithTransport):
389
def test_parent_alias(self):
390
t = self.make_branch_and_tree('base')
391
t.branch.get_config_stack().set('test', 'base')
392
clone = t.branch.bzrdir.sprout('clone').open_branch()
393
clone.get_config_stack().set('test', 'clone')
394
out, err = self.run_bzr(['config', '-d', ':parent', 'test'],
396
self.assertEqual('base\n', out)