~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_mail_client.py

  • Committer: Gavin Panella
  • Date: 2009-01-05 16:04:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3927.
  • Revision ID: gavin@gromper.net-20090105160455-53hza92cww634sv1
Tests for the Claws mail client.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    tests,
21
21
    urlutils,
22
22
    )
 
23
from bzrlib.tests.test_config import (
 
24
    InstrumentedConfig,
 
25
    )
23
26
 
24
27
class TestMutt(tests.TestCase):
25
28
 
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(None, None, 'file%')
 
191
        self.assertEqual(['--compose', '?attach=file%25'], commandline)
 
192
        commandline = claws._get_compose_commandline(
 
193
            'jrandom@example.org', 'Hi there!', None)
 
194
        self.assertEqual(
 
195
            ['--compose', 'jrandom@example.org?subject=Hi%20there%21'],
 
196
            commandline)
 
197
 
 
198
    def test_commandline_with_config(self):
 
199
        claws = mail_client.Claws(InstrumentedConfig())
 
200
        commandline = claws._get_compose_commandline(None, None, 'file%')
 
201
        self.assertEqual(
 
202
            ['--compose', ('?attach=file%25&from=Robert%20Collins%20'
 
203
                           '%3Crobert.collins%40example.org%3E')],
 
204
            commandline)
 
205
        commandline = claws._get_compose_commandline(
 
206
            'jrandom@example.org', 'Hi there!', None)
 
207
        self.assertEqual(
 
208
            ['--compose', ('jrandom@example.org?subject=Hi%20there%21'
 
209
                           '&from=Robert%20Collins%20'
 
210
                           '%3Crobert.collins%40example.org%3E')],
 
211
            commandline)
 
212
 
 
213
    def test_commandline_is_8bit(self):
 
214
        claws = mail_client.Claws(None)
 
215
        cmdline = claws._get_compose_commandline(
 
216
            u'jrandom@example.org', u'Hi there!', u'file%')
 
217
        self.assertEqual(
 
218
            ['--compose',
 
219
             'jrandom@example.org?subject=Hi%20there%21&attach=file%25'],
 
220
            cmdline)
 
221
        for item in cmdline:
 
222
            self.assertFalse(isinstance(item, unicode),
 
223
                'Command-line item %r is unicode!' % item)
 
224
 
 
225
 
183
226
class TestEditor(tests.TestCase):
184
227
 
185
228
    def test_get_merge_prompt_unicode(self):