~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-11-08 13:45:51 UTC
  • mfrom: (5532.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20101108134551-sxvk77ehmegkrwmm
(vila) Fix news entry

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
        super(TestConfigDisplay, self).setUp()
75
75
        _t_config.create_configs(self)
76
76
 
77
 
    def test_multiline_all_values(self):
78
 
        self.bazaar_config.set_user_option('multiline', '1\n2\n')
79
 
        script.run_script(self, """\
80
 
            $ bzr config -d tree
81
 
            bazaar:
82
 
              multiline = '''1
83
 
            2
84
 
            '''
85
 
            """)
86
 
 
87
 
    def test_multiline_value_only(self):
88
 
        self.bazaar_config.set_user_option('multiline', '1\n2\n')
89
 
        script.run_script(self, """\
90
 
            $ bzr config -d tree multiline
91
 
            '''1
92
 
            2
93
 
            '''
94
 
            """)
95
 
 
96
 
    def test_list_all_values(self):
97
 
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
98
 
        script.run_script(self, '''\
99
 
            $ bzr config -d tree
100
 
            bazaar:
101
 
              list = 1, a, "with, a comma"
102
 
            ''')
103
 
 
104
 
    def test_list_value_only(self):
105
 
        self.bazaar_config.set_user_option('list', [1, 'a', 'with, a comma'])
106
 
        script.run_script(self, '''\
107
 
            $ bzr config -d tree list
108
 
            1, a, "with, a comma"
109
 
            ''')
110
 
 
111
77
    def test_bazaar_config(self):
112
78
        self.bazaar_config.set_user_option('hello', 'world')
113
79
        script.run_script(self, '''\
122
88
        script.run_script(self, '''\
123
89
            $ bzr config -d tree
124
90
            locations:
125
 
              [.../tree]
126
91
              hello = world
127
92
            branch:
128
93
              hello = you
137
102
              hello = world
138
103
            ''')
139
104
 
140
 
class TestConfigDisplayWithPolicy(tests.TestCaseWithTransport):
141
 
 
142
 
    def test_location_with_policy(self):
143
 
        # LocationConfig is the only one dealing with policies so far.
144
 
        self.make_branch_and_tree('tree')
145
 
        config_text = """\
146
 
[%(dir)s]
147
 
url = dir
148
 
url:policy = appendpath
149
 
[%(dir)s/tree]
150
 
url = tree
151
 
""" % {'dir': self.test_dir}
152
 
        # We don't use the config directly so we save it to disk
153
 
        config.LocationConfig.from_string(config_text, 'tree', save=True)
154
 
        # policies are displayed with their options since they are part of
155
 
        # their definition, likewise the path is not appended, we are just
156
 
        # presenting the relevant portions of the config files
157
 
        script.run_script(self, '''\
158
 
            $ bzr config -d tree --all url
159
 
            locations:
160
 
              [.../work/tree]
161
 
              url = tree
162
 
              [.../work]
163
 
              url = dir
164
 
              url:policy = appendpath
165
 
            ''')
166
 
 
167
105
 
168
106
class TestConfigActive(tests.TestCaseWithTransport):
169
107
 
224
162
            $ bzr config -d tree --scope locations hello=world
225
163
            $ bzr config -d tree --all hello
226
164
            locations:
227
 
              [.../work/tree]
228
165
              hello = world
229
166
            ''')
230
167
 
260
197
            $ bzr config --scope bazaar --remove file
261
198
            $ bzr config -d tree --all file
262
199
            locations:
263
 
              [.../work/tree]
264
200
              file = locations
265
201
            branch:
266
202
              file = branch
271
207
            $ bzr config -d tree --scope bazaar --remove file
272
208
            $ bzr config -d tree --all file
273
209
            locations:
274
 
              [.../work/tree]
275
210
              file = locations
276
211
            branch:
277
212
              file = branch
308
243
            $ bzr config -d tree --scope branch --remove file
309
244
            $ bzr config -d tree --all file
310
245
            locations:
311
 
              [.../work/tree]
312
246
              file = locations
313
247
            bazaar:
314
248
              file = bazaar