577
577
def test_config_dir(self):
578
578
self.assertEqual(config.config_dir(), self.bzr_home)
580
def test_config_dir_is_unicode(self):
581
self.assertIsInstance(config.config_dir(), unicode)
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')
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)
1913
config.set_user_option('mail_client', 'evolution')
1914
client = config.get_mail_client()
1915
self.assertIsInstance(client, mail_client.Evolution)
1917
config.set_user_option('mail_client', 'kmail')
1918
client = config.get_mail_client()
1919
self.assertIsInstance(client, mail_client.KMail)
1921
config.set_user_option('mail_client', 'mutt')
1922
client = config.get_mail_client()
1923
self.assertIsInstance(client, mail_client.Mutt)
1925
config.set_user_option('mail_client', 'thunderbird')
1926
client = config.get_mail_client()
1927
self.assertIsInstance(client, mail_client.Thunderbird)
1930
config.set_user_option('mail_client', 'default')
1931
client = config.get_mail_client()
1932
self.assertIsInstance(client, mail_client.DefaultMail)
1934
config.set_user_option('mail_client', 'editor')
1935
client = config.get_mail_client()
1936
self.assertIsInstance(client, mail_client.Editor)
1938
config.set_user_option('mail_client', 'mapi')
1939
client = config.get_mail_client()
1940
self.assertIsInstance(client, mail_client.MAPIClient)
1942
config.set_user_option('mail_client', 'xdg-email')
1943
client = config.get_mail_client()
1944
self.assertIsInstance(client, mail_client.XDGEmail)
1946
config.set_user_option('mail_client', 'firebird')
1947
self.assertRaises(errors.UnknownMailClient, config.get_mail_client)
1950
1911
class TestMailAddressExtraction(tests.TestCase):
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'))
4855
class MailClientOptionTests(tests.TestCase):
4857
def test_default(self):
4858
conf = config.MemoryStack('')
4859
client = conf.get('mail_client')
4860
self.assertIs(client, mail_client.DefaultMail)
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)
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)
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)
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)
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)
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)
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)
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)
4902
def test_unknown(self):
4903
conf = config.MemoryStack('mail_client=firebird')
4904
self.assertRaises(errors.ConfigOptionValueError, conf.get,