~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-11-24 16:01:57 UTC
  • mfrom: (4597.13.7 cleanup)
  • mto: This revision was merged to the branch mainline in revision 5558.
  • Revision ID: v.ladeuil+lp@free.fr-20101124160157-kieuslo7wj9abdmb
Merge cleanup into 638451-malformed

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
 
77
111
    def test_bazaar_config(self):
78
112
        self.bazaar_config.set_user_option('hello', 'world')
79
113
        script.run_script(self, '''\
88
122
        script.run_script(self, '''\
89
123
            $ bzr config -d tree
90
124
            locations:
 
125
              [.../tree]
91
126
              hello = world
92
127
            branch:
93
128
              hello = you
102
137
              hello = world
103
138
            ''')
104
139
 
 
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
 
105
167
 
106
168
class TestConfigActive(tests.TestCaseWithTransport):
107
169
 
162
224
            $ bzr config -d tree --scope locations hello=world
163
225
            $ bzr config -d tree --all hello
164
226
            locations:
 
227
              [.../work/tree]
165
228
              hello = world
166
229
            ''')
167
230
 
197
260
            $ bzr config --scope bazaar --remove file
198
261
            $ bzr config -d tree --all file
199
262
            locations:
 
263
              [.../work/tree]
200
264
              file = locations
201
265
            branch:
202
266
              file = branch
207
271
            $ bzr config -d tree --scope bazaar --remove file
208
272
            $ bzr config -d tree --all file
209
273
            locations:
 
274
              [.../work/tree]
210
275
              file = locations
211
276
            branch:
212
277
              file = branch
243
308
            $ bzr config -d tree --scope branch --remove file
244
309
            $ bzr config -d tree --all file
245
310
            locations:
 
311
              [.../work/tree]
246
312
              file = locations
247
313
            bazaar:
248
314
              file = bazaar