~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Aaron Bentley
  • Date: 2012-06-19 16:36:07 UTC
  • mto: This revision was merged to the branch mainline in revision 6526.
  • Revision ID: aaron@aaronbentley.com-20120619163607-5bf7dnlw79k86fxj
branchname falls back to basename.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3419
3419
        matcher = config.LocationMatcher(store, expected_url)
3420
3420
        self.assertEquals(expected_location, matcher.location)
3421
3421
 
3422
 
    def test_branch_name(self):
3423
 
        store = self.get_store(self)
3424
 
        store._load_from_string(dedent("""\
3425
 
            [/]
3426
 
            push_location=my{branchname}
3427
 
        """))
3428
 
        matcher = config.LocationMatcher(store, 'file:///,branch=example')
3429
 
        self.assertEqual('example', matcher.branch_name)
3430
 
        ((_, section),) = matcher.get_sections()
3431
 
        self.assertEqual('example', section.locals['branchname'])
3432
 
 
3433
 
    def test_no_branch_name(self):
3434
 
        store = self.get_store(self)
3435
 
        store._load_from_string(dedent("""\
3436
 
            [/]
3437
 
            push_location=my{branchname}
3438
 
        """))
3439
 
        matcher = config.LocationMatcher(store, 'file:///')
3440
 
        self.assertIs(None, matcher.branch_name)
3441
 
        ((_, section),) = matcher.get_sections()
3442
 
        self.assertEqual('', section.locals['branchname'])
 
3422
    def test_branch_name_colo(self):
 
3423
        store = self.get_store(self)
 
3424
        store._load_from_string(dedent("""\
 
3425
            [/]
 
3426
            push_location=my{branchname}
 
3427
        """))
 
3428
        matcher = config.LocationMatcher(store, 'file:///,branch=example%3c')
 
3429
        self.assertEqual('example<', matcher.branch_name)
 
3430
        ((_, section),) = matcher.get_sections()
 
3431
        self.assertEqual('example<', section.locals['branchname'])
 
3432
 
 
3433
    def test_branch_name_basename(self):
 
3434
        store = self.get_store(self)
 
3435
        store._load_from_string(dedent("""\
 
3436
            [/]
 
3437
            push_location=my{branchname}
 
3438
        """))
 
3439
        matcher = config.LocationMatcher(store, 'file:///parent/example%3c')
 
3440
        self.assertEqual('example<', matcher.branch_name)
 
3441
        ((_, section),) = matcher.get_sections()
 
3442
        self.assertEqual('example<', section.locals['branchname'])
 
3443
 
3443
3444
 
3444
3445
class TestStartingPathMatcher(TestStore):
3445
3446