~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Removed changes from bzr.ab 1529..1536

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
                      "email=Robert Collins <robertc@example.com>\n"
33
33
                      "editor=vim\n"
34
34
                      "gpg_signing_command=gnome-gpg\n"
35
 
                      "user_global_option=something\n"
36
 
                      "[COMMAND_DEFAULTS]\n"
37
 
                      'commit=-m "log message" #evil? possibly.')
 
35
                      "user_global_option=something\n")
38
36
 
39
37
 
40
38
sample_always_signatures = ("[DEFAULT]\n"
320
318
                         my_config.signature_checking())
321
319
        self.assertEqual(False, my_config.signature_needed())
322
320
 
323
 
    def _config_from_str(self, config_str):
324
 
        config_file = StringIO(config_str)
325
 
        my_config = config.GlobalConfig()
326
 
        my_config._parser = my_config._get_parser(file=config_file)
327
 
        return my_config
328
 
 
329
321
    def _get_sample_config(self):
330
 
        return self._config_from_str(sample_config_text)
 
322
        config_file = StringIO(sample_config_text)
 
323
        my_config = config.GlobalConfig()
 
324
        my_config._parser = my_config._get_parser(file=config_file)
 
325
        return my_config
331
326
 
332
327
    def test_gpg_signing_command(self):
333
328
        my_config = self._get_sample_config()
357
352
        my_config = self._get_sample_config()
358
353
        self.assertEqual(None, my_config.post_commit())
359
354
 
360
 
    def test_command_defaults(self):
361
 
        my_config = self._get_sample_config()
362
 
        self.assertEqual(['-m', 'log message'], 
363
 
                         my_config.get_command_defaults('commit'))
364
 
        self.assertEqual([], my_config.get_command_defaults('log'))
365
 
 
366
 
    def test_bogus_command_default(self):
367
 
        my_config = self._config_from_str("""[COMMAND_DEFAULTS]
368
 
                                          merge=--merge-type 'weave'
369
 
                                          remerge=--merge-type 'weave
370
 
                                          """)
371
 
        self.assertEqual(['--merge-type', 'weave'], 
372
 
                         my_config.get_command_defaults('merge'))
373
 
        self.assertRaises(errors.CommandDefaultSyntax, 
374
 
                          my_config.get_command_defaults, 'remerge')
375
 
 
376
355
 
377
356
class TestLocationConfig(TestCase):
378
357