~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: 2012-07-24 13:25:42 UTC
  • mfrom: (6538.4.6 mailname-first-line)
  • Revision ID: pqm@pqm.ubuntu.com-20120724132542-5e7aakd1c3t9oggf
(jelmer) Only read the first line from /etc/mailname. (Haw Loeung)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4568
4568
                                           port=99, path='/foo',
4569
4569
                                           realm='realm')
4570
4570
        CREDENTIALS = {'name': 'name', 'user': 'user', 'password': 'password',
4571
 
                       'verify_certificates': False, 'scheme': 'scheme', 
4572
 
                       'host': 'host', 'port': 99, 'path': '/foo', 
 
4571
                       'verify_certificates': False, 'scheme': 'scheme',
 
4572
                       'host': 'host', 'port': 99, 'path': '/foo',
4573
4573
                       'realm': 'realm'}
4574
4574
        self.assertEqual(CREDENTIALS, credentials)
4575
4575
        credentials_from_disk = config.AuthenticationConfig().get_credentials(
4583
4583
        self.assertIs(None, conf._get_config().get('name'))
4584
4584
        credentials = conf.get_credentials(host='host', scheme='scheme')
4585
4585
        CREDENTIALS = {'name': 'name2', 'user': 'user2', 'password':
4586
 
                       'password', 'verify_certificates': True, 
4587
 
                       'scheme': 'scheme', 'host': 'host', 'port': None, 
 
4586
                       'password', 'verify_certificates': True,
 
4587
                       'scheme': 'scheme', 'host': 'host', 'port': None,
4588
4588
                       'path': None, 'realm': None}
4589
4589
        self.assertEqual(CREDENTIALS, credentials)
4590
4590
 
4876
4876
            self.assertEquals((None, None), (realname, address))
4877
4877
 
4878
4878
 
 
4879
class TestDefaultMailDomain(tests.TestCaseInTempDir):
 
4880
    """Test retrieving default domain from mailname file"""
 
4881
 
 
4882
    def test_default_mail_domain_simple(self):
 
4883
        f = file('simple', 'w')
 
4884
        try:
 
4885
            f.write("domainname.com\n")
 
4886
        finally:
 
4887
            f.close()
 
4888
        r = config._get_default_mail_domain('simple')
 
4889
        self.assertEquals('domainname.com', r)
 
4890
 
 
4891
    def test_default_mail_domain_no_eol(self):
 
4892
        f = file('no_eol', 'w')
 
4893
        try:
 
4894
            f.write("domainname.com")
 
4895
        finally:
 
4896
            f.close()
 
4897
        r = config._get_default_mail_domain('no_eol')
 
4898
        self.assertEquals('domainname.com', r)
 
4899
 
 
4900
    def test_default_mail_domain_multiple_lines(self):
 
4901
        f = file('multiple_lines', 'w')
 
4902
        try:
 
4903
            f.write("domainname.com\nsome other text\n")
 
4904
        finally:
 
4905
            f.close()
 
4906
        r = config._get_default_mail_domain('multiple_lines')
 
4907
        self.assertEquals('domainname.com', r)
 
4908
 
 
4909
 
4879
4910
class EmailOptionTests(tests.TestCase):
4880
4911
 
4881
4912
    def test_default_email_uses_BZR_EMAIL(self):