~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testconfig.py

  • Committer: Robert Collins
  • Date: 2005-10-14 04:34:37 UTC
  • mto: This revision was merged to the branch mainline in revision 1456.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051014043437-11ff9c436c3c6995
make getting the signature checking policy a template method

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
    def __init__(self):
82
82
        super(InstrumentedConfig, self).__init__()
83
83
        self._calls = []
 
84
        self._signatures = config.CHECK_NEVER
84
85
 
85
86
    def _get_user_id(self):
86
87
        self._calls.append('_get_user_id')
87
88
        return "Robert Collins <robert.collins@example.org>"
88
89
 
 
90
    def _get_signature_checking(self):
 
91
        self._calls.append('_get_signature_checking')
 
92
        return self._signatures
 
93
 
89
94
 
90
95
class TestConfig(TestCase):
91
96
 
111
116
        self.assertEqual(config.CHECK_IF_POSSIBLE,
112
117
                         my_config.signature_checking())
113
118
 
114
 
#    def test_signatures(self):
115
 
#        my_config = InstrumentedConfig()
116
 
#        self.assertEqual('Robert Collins <robert.collins@example.org>',
117
 
#                         my_config.username())
118
 
#        self.assertEqual(['_get_user_id'], my_config._calls)
119
 
#
 
119
    def test_signatures_template_method(self):
 
120
        my_config = InstrumentedConfig()
 
121
        self.assertEqual(config.CHECK_NEVER, my_config.signature_checking())
 
122
        self.assertEqual(['_get_signature_checking'], my_config._calls)
 
123
 
 
124
    def test_signatures_template_method_none(self):
 
125
        my_config = InstrumentedConfig()
 
126
        my_config._signatures = None
 
127
        self.assertEqual(config.CHECK_IF_POSSIBLE,
 
128
                         my_config.signature_checking())
 
129
        self.assertEqual(['_get_signature_checking'], my_config._calls)
 
130
 
120
131
 
121
132
class TestConfigPath(TestCase):
122
133