/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_mail_client.py

  • Committer: Andrew Bennetts
  • Date: 2009-01-27 05:04:43 UTC
  • mfrom: (3960 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3981.
  • Revision ID: andrew.bennetts@canonical.com-20090127050443-3yw5hhk10ss23hzu
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
import urllib
 
18
 
17
19
from bzrlib import (
18
20
    errors,
19
21
    mail_client,
20
22
    tests,
21
23
    urlutils,
 
24
    osutils,
22
25
    )
23
26
 
24
27
class TestMutt(tests.TestCase):
180
183
                'Command-line item %r is unicode!' % item)
181
184
 
182
185
 
 
186
class TestClaws(tests.TestCase):
 
187
 
 
188
    def test_commandline(self):
 
189
        claws = mail_client.Claws(None)
 
190
        commandline = claws._get_compose_commandline(
 
191
            None, None, 'file%')
 
192
        self.assertEqual(
 
193
            ['--compose', 'mailto:?', '--attach', 'file%'], commandline)
 
194
        commandline = claws._get_compose_commandline(
 
195
            'jrandom@example.org', 'Hi there!', None)
 
196
        self.assertEqual(
 
197
            ['--compose',
 
198
             'mailto:jrandom@example.org?subject=Hi%20there%21'],
 
199
            commandline)
 
200
 
 
201
    def test_commandline_is_8bit(self):
 
202
        claws = mail_client.Claws(None)
 
203
        cmdline = claws._get_compose_commandline(
 
204
            u'jrandom@example.org', u'\xb5cosm of fun!', u'file%')
 
205
        subject_string = urllib.quote(
 
206
            u'\xb5cosm of fun!'.encode(osutils.get_user_encoding(), 'replace'))
 
207
        self.assertEqual(
 
208
            ['--compose',
 
209
             'mailto:jrandom@example.org?subject=%s' % subject_string,
 
210
             '--attach',
 
211
             'file%'],
 
212
            cmdline)
 
213
        for item in cmdline:
 
214
            self.assertFalse(isinstance(item, unicode),
 
215
                'Command-line item %r is unicode!' % item)
 
216
 
 
217
 
183
218
class TestEditor(tests.TestCase):
184
219
 
185
220
    def test_get_merge_prompt_unicode(self):