/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Vincent Ladeuil
  • Date: 2011-09-07 15:21:39 UTC
  • mto: (6123.1.13 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6124.
  • Revision ID: v.ladeuil+lp@free.fr-20110907152139-wb368iwapfzqqtkm
Rename IdMatcher to NameMatcher.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3064
3064
class TestSectionMatcher(TestStore):
3065
3065
 
3066
3066
    scenarios = [('location', {'matcher': config.LocationMatcher}),
3067
 
                 ('id', {'matcher': config.IdMatcher}),]
 
3067
                 ('id', {'matcher': config.NameMatcher}),]
3068
3068
 
3069
3069
    def get_store(self, file_name):
3070
3070
        return config.IniFileStore(self.get_readonly_transport(), file_name)
3179
3179
        self.assertEquals(expected_location, matcher.location)
3180
3180
 
3181
3181
 
3182
 
class TestIdMatcher(TestStore):
 
3182
class TestNameMatcher(TestStore):
3183
3183
 
3184
3184
    def setUp(self):
3185
 
        super(TestIdMatcher, self).setUp()
 
3185
        super(TestNameMatcher, self).setUp()
3186
3186
        self.store = config.IniFileStore(self.get_readonly_transport(),
3187
3187
                                         'foo.conf')
3188
3188
        self.store._load_from_string('''
3194
3194
option=bar
3195
3195
''')
3196
3196
 
 
3197
    def get_matching_sections(self, name):
 
3198
        matcher = config.NameMatcher(self.store, name)
 
3199
        return list(matcher.get_sections())
 
3200
 
3197
3201
    def test_matching(self):
3198
 
        matcher = config.IdMatcher(self.store, 'foo')
3199
 
        sections = list(matcher.get_sections())
 
3202
        sections = self.get_matching_sections('foo')
3200
3203
        self.assertLength(1, sections)
3201
3204
        self.assertSectionContent(('foo', {'option': 'foo'}), sections[0])
3202
3205
 
3203
3206
    def test_not_matching(self):
3204
 
        matcher = config.IdMatcher(self.store, 'baz')
3205
 
        sections = list(matcher.get_sections())
 
3207
        sections = self.get_matching_sections('baz')
3206
3208
        self.assertLength(0, sections)
3207
3209
 
3208
3210