~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-15 12:18:53 UTC
  • mfrom: (6374.1.3 config-store-BZR_EMAIL)
  • Revision ID: pqm@pqm.ubuntu.com-20111215121853-1jw97a5rjazzqnbi
(jelmer) BZR_EMAIL should be respected for the 'email' config option default
 value. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4539
4539
 
4540
4540
    def test_auto_user_id(self):
4541
4541
        """Automatic inference of user name.
4542
 
        
 
4542
 
4543
4543
        This is a bit hard to test in an isolated way, because it depends on
4544
4544
        system functions that go direct to /etc or perhaps somewhere else.
4545
4545
        But it's reasonable to say that on Unix, with an /etc/mailname, we ought
4555
4555
        else:
4556
4556
            self.assertEquals((None, None), (realname, address))
4557
4557
 
 
4558
 
 
4559
class EmailOptionTests(tests.TestCase):
 
4560
 
 
4561
    def test_default_email_uses_BZR_EMAIL(self):
 
4562
        # BZR_EMAIL takes precedence over EMAIL
 
4563
        self.overrideEnv('BZR_EMAIL', 'jelmer@samba.org')
 
4564
        self.overrideEnv('EMAIL', 'jelmer@apache.org')
 
4565
        self.assertEquals('jelmer@samba.org', config.default_email())
 
4566
 
 
4567
    def test_default_email_uses_EMAIL(self):
 
4568
        self.overrideEnv('BZR_EMAIL', None)
 
4569
        self.overrideEnv('EMAIL', 'jelmer@apache.org')
 
4570
        self.assertEquals('jelmer@apache.org', config.default_email())
 
4571
 
 
4572
    def test_BZR_EMAIL_overrides(self):
 
4573
        self.overrideEnv('BZR_EMAIL', 'jelmer@apache.org')
 
4574
        self.assertEquals('jelmer@apache.org',
 
4575
            config.email_from_store('jelmer@debian.org'))
 
4576
        self.overrideEnv('BZR_EMAIL', None)
 
4577
        self.overrideEnv('EMAIL', 'jelmer@samba.org')
 
4578
        self.assertEquals('jelmer@debian.org',
 
4579
            config.email_from_store('jelmer@debian.org'))