~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Erik Bågfors
  • Date: 2006-02-22 20:33:25 UTC
  • mto: (1558.1.9 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 1574.
  • Revision ID: erik@bagfors.nu-20060222203325-33baad9691a8ed45
remove AliasConfig, based on input from abentley

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.tests import TestCase, TestCaseInTempDir
29
29
 
30
30
 
 
31
sample_long_alias="log -r-15..-1 --line"
31
32
sample_config_text = ("[DEFAULT]\n"
32
33
                      "email=Robert Collins <robertc@example.com>\n"
33
34
                      "editor=vim\n"
34
35
                      "gpg_signing_command=gnome-gpg\n"
35
36
                      "log_format=short\n"
36
 
                      "user_global_option=something\n")
 
37
                      "user_global_option=something\n"
 
38
                      "[ALIASES]\n"
 
39
                      "h=help\n"
 
40
                      "ll=" + sample_long_alias + "\n")
37
41
 
38
42
 
39
43
sample_always_signatures = ("[DEFAULT]\n"
70
74
                        "post_commit=bzrlib.tests.test_config.post_commit\n"
71
75
                        "#testing explicit beats globs\n")
72
76
 
73
 
sample_long_alias="log -r-15..-1 --line"
74
 
 
75
 
sample_aliases = ("[ALIASES]\n"
76
 
                  "h=help\n"
77
 
                  "ll=" + sample_long_alias + "\n"
78
 
                  )
79
77
 
80
78
 
81
79
class InstrumentedConfigObj(object):
368
366
        my_config = self._get_sample_config()
369
367
        self.assertEqual("short", my_config.log_format())
370
368
 
 
369
    def test_get_alias(self):
 
370
        my_config = self._get_sample_config()
 
371
        self.assertEqual('help', my_config.get_alias('h'))
 
372
 
 
373
    def test_get_no_alias(self):
 
374
        my_config = self._get_sample_config()
 
375
        self.assertEqual(None, my_config.get_alias('foo'))
 
376
 
 
377
    def test_get_long_alias(self):
 
378
        my_config = self._get_sample_config()
 
379
        self.assertEqual(sample_long_alias, my_config.get_alias('ll'))
371
380
 
372
381
class TestLocationConfig(TestCase):
373
382
 
622
631
        self.assertEqual('bzrlib.tests.test_config.post_commit',
623
632
                         my_config.post_commit())
624
633
 
625
 
class TestAliasesConfig(TestCase):
626
 
 
627
 
    def test_get_alias(self):
628
 
        config_file = StringIO(sample_aliases)
629
 
        my_config = config.AliasConfig()
630
 
        my_config._parser = my_config._get_parser(file=config_file)
631
 
        self.assertEqual('help', my_config.get_alias('h'))
632
 
 
633
 
    def test_get_no_alias(self):
634
 
        config_file = StringIO(sample_aliases)
635
 
        my_config = config.AliasConfig()
636
 
        my_config._parser = my_config._get_parser(file=config_file)
637
 
        self.assertEqual(None, my_config.get_alias('foo'))
638
 
 
639
 
    def test_get_long_alias(self):
640
 
        config_file = StringIO(sample_aliases)
641
 
        my_config = config.AliasConfig()
642
 
        my_config._parser = my_config._get_parser(file=config_file)
643
 
        self.assertEqual(sample_long_alias, my_config.get_alias('ll'))
644
634
 
645
635
class TestMailAddressExtraction(TestCase):
646
636