~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

Merged aliases

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"
71
75
                        "#testing explicit beats globs\n")
72
76
 
73
77
 
 
78
 
74
79
class InstrumentedConfigObj(object):
75
80
    """A config obj look-enough-alike to record calls made to it."""
76
81
 
378
383
        my_config = self._get_sample_config()
379
384
        self.assertEqual("short", my_config.log_format())
380
385
 
 
386
    def test_get_alias(self):
 
387
        my_config = self._get_sample_config()
 
388
        self.assertEqual('help', my_config.get_alias('h'))
 
389
 
 
390
    def test_get_no_alias(self):
 
391
        my_config = self._get_sample_config()
 
392
        self.assertEqual(None, my_config.get_alias('foo'))
 
393
 
 
394
    def test_get_long_alias(self):
 
395
        my_config = self._get_sample_config()
 
396
        self.assertEqual(sample_long_alias, my_config.get_alias('ll'))
381
397
 
382
398
class TestLocationConfig(TestCase):
383
399