bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2681.1.8
by Aaron Bentley
Add Thunderbird support to bzr send |
1 |
# Copyright (C) 2007 Canonical Ltd
|
2 |
#
|
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
from bzrlib import ( |
|
|
3042.1.2
by Lukáš Lalinský
Don't use None as address in TestXDGEmail and add a test to check if it raises NoMailAddressSpecified with None. |
18 |
errors, |
|
2681.1.8
by Aaron Bentley
Add Thunderbird support to bzr send |
19 |
mail_client, |
20 |
tests, |
|
21 |
urlutils, |
|
22 |
)
|
|
23 |
||
|
2790.2.1
by Keir Mierle
Add Mutt as a supported client email program. Also rearranges various listings |
24 |
class TestMutt(tests.TestCase): |
25 |
||
26 |
def test_commandline(self): |
|
27 |
mutt = mail_client.Mutt(None) |
|
28 |
commandline = mutt._get_compose_commandline(None, None, 'file%') |
|
29 |
self.assertEqual(['-a', 'file%'], commandline) |
|
30 |
commandline = mutt._get_compose_commandline('jrandom@example.org', |
|
31 |
'Hi there!', None) |
|
32 |
self.assertEqual(['-s', 'Hi there!', 'jrandom@example.org'], |
|
33 |
commandline) |
|
34 |
||
|
2681.1.8
by Aaron Bentley
Add Thunderbird support to bzr send |
35 |
|
36 |
class TestThunderbird(tests.TestCase): |
|
37 |
||
38 |
def test_commandline(self): |
|
|
2681.1.9
by Aaron Bentley
Add support for mail-from-editor |
39 |
tbird = mail_client.Thunderbird(None) |
|
2681.1.8
by Aaron Bentley
Add Thunderbird support to bzr send |
40 |
commandline = tbird._get_compose_commandline(None, None, |
41 |
'file%') |
|
42 |
self.assertEqual(['-compose', "attachment='%s'" % |
|
43 |
urlutils.local_path_to_url('file%')], commandline) |
|
44 |
commandline = tbird._get_compose_commandline('jrandom@example.org', |
|
45 |
'Hi there!', None) |
|
46 |
self.assertEqual(['-compose', "subject='Hi there!'," |
|
47 |
"to='jrandom@example.org'"], commandline) |
|
|
2681.2.1
by Lukáš Lalinsky
Support for Evolution mail client. |
48 |
|
49 |
||
|
2681.1.23
by Aaron Bentley
Add support for xdg-email |
50 |
class TestXDGEmail(tests.TestCase): |
51 |
||
52 |
def test_commandline(self): |
|
53 |
xdg_email = mail_client.XDGEmail(None) |
|
|
3042.1.2
by Lukáš Lalinský
Don't use None as address in TestXDGEmail and add a test to check if it raises NoMailAddressSpecified with None. |
54 |
self.assertRaises(errors.NoMailAddressSpecified, |
55 |
xdg_email._get_compose_commandline, |
|
56 |
None, None, 'file%') |
|
57 |
commandline = xdg_email._get_compose_commandline( |
|
58 |
'jrandom@example.org', None, 'file%') |
|
59 |
self.assertEqual(['jrandom@example.org', '--attach', 'file%'], |
|
60 |
commandline) |
|
|
2681.1.23
by Aaron Bentley
Add support for xdg-email |
61 |
commandline = xdg_email._get_compose_commandline( |
62 |
'jrandom@example.org', 'Hi there!', None) |
|
63 |
self.assertEqual(['jrandom@example.org', '--subject', 'Hi there!'], |
|
64 |
commandline) |
|
65 |
||
66 |
||
|
2681.2.1
by Lukáš Lalinsky
Support for Evolution mail client. |
67 |
class TestEvolution(tests.TestCase): |
68 |
||
69 |
def test_commandline(self): |
|
70 |
evo = mail_client.Evolution(None) |
|
71 |
commandline = evo._get_compose_commandline(None, None, 'file%') |
|
|
2681.1.18
by Aaron Bentley
Refactor to increase code sharing, allow multiple command names for tbird |
72 |
self.assertEqual(['mailto:?attach=file%25'], commandline) |
|
2681.2.1
by Lukáš Lalinsky
Support for Evolution mail client. |
73 |
commandline = evo._get_compose_commandline('jrandom@example.org', |
74 |
'Hi there!', None) |
|
|
2681.1.18
by Aaron Bentley
Refactor to increase code sharing, allow multiple command names for tbird |
75 |
self.assertEqual(['mailto:jrandom@example.org?subject=Hi%20there%21'], |
|
2681.2.1
by Lukáš Lalinsky
Support for Evolution mail client. |
76 |
commandline) |
|
2681.1.21
by Aaron Bentley
Refactor prompt generation to make it testable, test it with unicode |
77 |
|
78 |
||
|
2681.5.2
by ghigo
update docs and tests |
79 |
class TestKMail(tests.TestCase): |
80 |
||
81 |
def test_commandline(self): |
|
|
2681.1.35
by Aaron Bentley
Rename test var evo => kmail |
82 |
kmail = mail_client.KMail(None) |
83 |
commandline = kmail._get_compose_commandline(None, None, 'file%') |
|
|
2681.5.2
by ghigo
update docs and tests |
84 |
self.assertEqual(['--attach', 'file%'], commandline) |
|
2681.1.35
by Aaron Bentley
Rename test var evo => kmail |
85 |
commandline = kmail._get_compose_commandline('jrandom@example.org', |
86 |
'Hi there!', None) |
|
|
2681.5.2
by ghigo
update docs and tests |
87 |
self.assertEqual(['-s', 'Hi there!', 'jrandom@example.org'], |
88 |
commandline) |
|
89 |
||
90 |
||
|
2681.1.21
by Aaron Bentley
Refactor prompt generation to make it testable, test it with unicode |
91 |
class TestEditor(tests.TestCase): |
92 |
||
93 |
def test_get_merge_prompt_unicode(self): |
|
94 |
"""Prompt, to and subject are unicode, the attachement is binary""" |
|
95 |
editor = mail_client.Editor(None) |
|
96 |
prompt = editor._get_merge_prompt(u'foo\u1234', |
|
97 |
u'bar\u1234', |
|
98 |
u'baz\u1234', |
|
99 |
u'qux\u1234'.encode('utf-8')) |
|
100 |
self.assertContainsRe(prompt, u'foo\u1234(.|\n)*bar\u1234' |
|
101 |
u'(.|\n)*baz\u1234(.|\n)*qux\u1234') |
|
102 |
editor._get_merge_prompt(u'foo', u'bar', u'baz', 'qux\xff') |