1904
1904
location='http://example.com/specific')
1905
1905
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
1908
class TestMailAddressExtraction(tests.TestCase):
4889
4847
self.overrideEnv('BZR_EMAIL', None)
4890
4848
self.overrideEnv('EMAIL', 'jelmer@samba.org')
4891
4849
self.assertEquals('jelmer@debian.org', conf.get('email'))
4852
class MailClientOptionTests(tests.TestCase):
4854
def test_default(self):
4855
conf = config.MemoryStack('')
4856
client = conf.get('mail_client')
4857
self.assertIs(client, mail_client.DefaultMail)
4859
def test_evolution(self):
4860
conf = config.MemoryStack('mail_client=evolution')
4861
client = conf.get('mail_client')
4862
self.assertIs(client, mail_client.Evolution)
4864
def test_kmail(self):
4865
conf = config.MemoryStack('mail_client=kmail')
4866
client = conf.get('mail_client')
4867
self.assertIs(client, mail_client.KMail)
4869
def test_mutt(self):
4870
conf = config.MemoryStack('mail_client=mutt')
4871
client = conf.get('mail_client')
4872
self.assertIs(client, mail_client.Mutt)
4874
def test_thunderbird(self):
4875
conf = config.MemoryStack('mail_client=thunderbird')
4876
client = conf.get('mail_client')
4877
self.assertIs(client, mail_client.Thunderbird)
4879
def test_explicit_default(self):
4880
conf = config.MemoryStack('mail_client=default')
4881
client = conf.get('mail_client')
4882
self.assertIs(client, mail_client.DefaultMail)
4884
def test_editor(self):
4885
conf = config.MemoryStack('mail_client=editor')
4886
client = conf.get('mail_client')
4887
self.assertIs(client, mail_client.Editor)
4889
def test_mapi(self):
4890
conf = config.MemoryStack('mail_client=mapi')
4891
client = conf.get('mail_client')
4892
self.assertIs(client, mail_client.MAPIClient)
4894
def test_xdg_email(self):
4895
conf = config.MemoryStack('mail_client=xdg-email')
4896
client = conf.get('mail_client')
4897
self.assertIs(client, mail_client.XDGEmail)
4899
def test_unknown(self):
4900
conf = config.MemoryStack('mail_client=firebird')
4901
self.assertRaises(errors.ConfigOptionValueError, conf.get,