~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-15 11:26:00 UTC
  • mfrom: (5757.7.7 knitpackrepo-6)
  • mto: This revision was merged to the branch mainline in revision 5801.
  • Revision ID: jelmer@samba.org-20110415112600-vrv2431lh3gi6wx2
MergeĀ knitpackrepo-6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1264
1264
        self.failUnless(isinstance(global_config, config.GlobalConfig))
1265
1265
        self.failUnless(global_config is my_config._get_global_config())
1266
1266
 
 
1267
    def assertLocationMatching(self, expected):
 
1268
        self.assertEqual(expected,
 
1269
                         list(self.my_location_config._get_matching_sections()))
 
1270
 
1267
1271
    def test__get_matching_sections_no_match(self):
1268
1272
        self.get_branch_config('/')
1269
 
        self.assertEqual([], self.my_location_config._get_matching_sections())
 
1273
        self.assertLocationMatching([])
1270
1274
 
1271
1275
    def test__get_matching_sections_exact(self):
1272
1276
        self.get_branch_config('http://www.example.com')
1273
 
        self.assertEqual([('http://www.example.com', '')],
1274
 
                         self.my_location_config._get_matching_sections())
 
1277
        self.assertLocationMatching([('http://www.example.com', '')])
1275
1278
 
1276
1279
    def test__get_matching_sections_suffix_does_not(self):
1277
1280
        self.get_branch_config('http://www.example.com-com')
1278
 
        self.assertEqual([], self.my_location_config._get_matching_sections())
 
1281
        self.assertLocationMatching([])
1279
1282
 
1280
1283
    def test__get_matching_sections_subdir_recursive(self):
1281
1284
        self.get_branch_config('http://www.example.com/com')
1282
 
        self.assertEqual([('http://www.example.com', 'com')],
1283
 
                         self.my_location_config._get_matching_sections())
 
1285
        self.assertLocationMatching([('http://www.example.com', 'com')])
1284
1286
 
1285
1287
    def test__get_matching_sections_ignoreparent(self):
1286
1288
        self.get_branch_config('http://www.example.com/ignoreparent')
1287
 
        self.assertEqual([('http://www.example.com/ignoreparent', '')],
1288
 
                         self.my_location_config._get_matching_sections())
 
1289
        self.assertLocationMatching([('http://www.example.com/ignoreparent',
 
1290
                                      '')])
1289
1291
 
1290
1292
    def test__get_matching_sections_ignoreparent_subdir(self):
1291
1293
        self.get_branch_config(
1292
1294
            'http://www.example.com/ignoreparent/childbranch')
1293
 
        self.assertEqual([('http://www.example.com/ignoreparent',
1294
 
                           'childbranch')],
1295
 
                         self.my_location_config._get_matching_sections())
 
1295
        self.assertLocationMatching([('http://www.example.com/ignoreparent',
 
1296
                                      'childbranch')])
1296
1297
 
1297
1298
    def test__get_matching_sections_subdir_trailing_slash(self):
1298
1299
        self.get_branch_config('/b')
1299
 
        self.assertEqual([('/b/', '')],
1300
 
                         self.my_location_config._get_matching_sections())
 
1300
        self.assertLocationMatching([('/b/', '')])
1301
1301
 
1302
1302
    def test__get_matching_sections_subdir_child(self):
1303
1303
        self.get_branch_config('/a/foo')
1304
 
        self.assertEqual([('/a/*', ''), ('/a/', 'foo')],
1305
 
                         self.my_location_config._get_matching_sections())
 
1304
        self.assertLocationMatching([('/a/*', ''), ('/a/', 'foo')])
1306
1305
 
1307
1306
    def test__get_matching_sections_subdir_child_child(self):
1308
1307
        self.get_branch_config('/a/foo/bar')
1309
 
        self.assertEqual([('/a/*', 'bar'), ('/a/', 'foo/bar')],
1310
 
                         self.my_location_config._get_matching_sections())
 
1308
        self.assertLocationMatching([('/a/*', 'bar'), ('/a/', 'foo/bar')])
1311
1309
 
1312
1310
    def test__get_matching_sections_trailing_slash_with_children(self):
1313
1311
        self.get_branch_config('/a/')
1314
 
        self.assertEqual([('/a/', '')],
1315
 
                         self.my_location_config._get_matching_sections())
 
1312
        self.assertLocationMatching([('/a/', '')])
1316
1313
 
1317
1314
    def test__get_matching_sections_explicit_over_glob(self):
1318
1315
        # XXX: 2006-09-08 jamesh
1320
1317
        # was a config section for '/a/?', it would get precedence
1321
1318
        # over '/a/c'.
1322
1319
        self.get_branch_config('/a/c')
1323
 
        self.assertEqual([('/a/c', ''), ('/a/*', ''), ('/a/', 'c')],
1324
 
                         self.my_location_config._get_matching_sections())
 
1320
        self.assertLocationMatching([('/a/c', ''), ('/a/*', ''), ('/a/', 'c')])
1325
1321
 
1326
1322
    def test__get_option_policy_normal(self):
1327
1323
        self.get_branch_config('http://www.example.com')