~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-06 11:36:02 UTC
  • mfrom: (6462 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6463.
  • Revision ID: jelmer@samba.org-20120206113602-yu3j0xe7qbk1szw9
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
577
577
    def test_config_dir(self):
578
578
        self.assertEqual(config.config_dir(), self.bzr_home)
579
579
 
 
580
    def test_config_dir_is_unicode(self):
 
581
        self.assertIsInstance(config.config_dir(), unicode)
 
582
 
580
583
    def test_config_filename(self):
581
584
        self.assertEqual(config.config_filename(),
582
585
                         self.bzr_home + '/bazaar.conf')
1904
1907
            location='http://example.com/specific')
1905
1908
        self.assertEqual(my_config.get_user_option('option'), 'exact')
1906
1909
 
1907
 
    def test_get_mail_client(self):
1908
 
        config = self.get_branch_config()
1909
 
        client = config.get_mail_client()
1910
 
        self.assertIsInstance(client, mail_client.DefaultMail)
1911
 
 
1912
 
        # Specific clients
1913
 
        config.set_user_option('mail_client', 'evolution')
1914
 
        client = config.get_mail_client()
1915
 
        self.assertIsInstance(client, mail_client.Evolution)
1916
 
 
1917
 
        config.set_user_option('mail_client', 'kmail')
1918
 
        client = config.get_mail_client()
1919
 
        self.assertIsInstance(client, mail_client.KMail)
1920
 
 
1921
 
        config.set_user_option('mail_client', 'mutt')
1922
 
        client = config.get_mail_client()
1923
 
        self.assertIsInstance(client, mail_client.Mutt)
1924
 
 
1925
 
        config.set_user_option('mail_client', 'thunderbird')
1926
 
        client = config.get_mail_client()
1927
 
        self.assertIsInstance(client, mail_client.Thunderbird)
1928
 
 
1929
 
        # Generic options
1930
 
        config.set_user_option('mail_client', 'default')
1931
 
        client = config.get_mail_client()
1932
 
        self.assertIsInstance(client, mail_client.DefaultMail)
1933
 
 
1934
 
        config.set_user_option('mail_client', 'editor')
1935
 
        client = config.get_mail_client()
1936
 
        self.assertIsInstance(client, mail_client.Editor)
1937
 
 
1938
 
        config.set_user_option('mail_client', 'mapi')
1939
 
        client = config.get_mail_client()
1940
 
        self.assertIsInstance(client, mail_client.MAPIClient)
1941
 
 
1942
 
        config.set_user_option('mail_client', 'xdg-email')
1943
 
        client = config.get_mail_client()
1944
 
        self.assertIsInstance(client, mail_client.XDGEmail)
1945
 
 
1946
 
        config.set_user_option('mail_client', 'firebird')
1947
 
        self.assertRaises(errors.UnknownMailClient, config.get_mail_client)
1948
 
 
1949
1910
 
1950
1911
class TestMailAddressExtraction(tests.TestCase):
1951
1912
 
4889
4850
        self.overrideEnv('BZR_EMAIL', None)
4890
4851
        self.overrideEnv('EMAIL', 'jelmer@samba.org')
4891
4852
        self.assertEquals('jelmer@debian.org', conf.get('email'))
 
4853
 
 
4854
 
 
4855
class MailClientOptionTests(tests.TestCase):
 
4856
 
 
4857
    def test_default(self):
 
4858
        conf = config.MemoryStack('')
 
4859
        client = conf.get('mail_client')
 
4860
        self.assertIs(client, mail_client.DefaultMail)
 
4861
 
 
4862
    def test_evolution(self):
 
4863
        conf = config.MemoryStack('mail_client=evolution')
 
4864
        client = conf.get('mail_client')
 
4865
        self.assertIs(client, mail_client.Evolution)
 
4866
 
 
4867
    def test_kmail(self):
 
4868
        conf = config.MemoryStack('mail_client=kmail')
 
4869
        client = conf.get('mail_client')
 
4870
        self.assertIs(client, mail_client.KMail)
 
4871
 
 
4872
    def test_mutt(self):
 
4873
        conf = config.MemoryStack('mail_client=mutt')
 
4874
        client = conf.get('mail_client')
 
4875
        self.assertIs(client, mail_client.Mutt)
 
4876
 
 
4877
    def test_thunderbird(self):
 
4878
        conf = config.MemoryStack('mail_client=thunderbird')
 
4879
        client = conf.get('mail_client')
 
4880
        self.assertIs(client, mail_client.Thunderbird)
 
4881
 
 
4882
    def test_explicit_default(self):
 
4883
        conf = config.MemoryStack('mail_client=default')
 
4884
        client = conf.get('mail_client')
 
4885
        self.assertIs(client, mail_client.DefaultMail)
 
4886
 
 
4887
    def test_editor(self):
 
4888
        conf = config.MemoryStack('mail_client=editor')
 
4889
        client = conf.get('mail_client')
 
4890
        self.assertIs(client, mail_client.Editor)
 
4891
 
 
4892
    def test_mapi(self):
 
4893
        conf = config.MemoryStack('mail_client=mapi')
 
4894
        client = conf.get('mail_client')
 
4895
        self.assertIs(client, mail_client.MAPIClient)
 
4896
 
 
4897
    def test_xdg_email(self):
 
4898
        conf = config.MemoryStack('mail_client=xdg-email')
 
4899
        client = conf.get('mail_client')
 
4900
        self.assertIs(client, mail_client.XDGEmail)
 
4901
 
 
4902
    def test_unknown(self):
 
4903
        conf = config.MemoryStack('mail_client=firebird')
 
4904
        self.assertRaises(errors.ConfigOptionValueError, conf.get,
 
4905
                'mail_client')