~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_mail_client.py

  • Committer: Robert J. Tanner
  • Date: 2009-06-10 03:56:49 UTC
  • mfrom: (4423 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4425.
  • Revision ID: tanner@real-time.com-20090610035649-7rfx4cls4550zc3c
Merge 1.15.1 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
    def test_commandline(self):
30
30
        mutt = mail_client.Mutt(None)
31
 
        commandline = mutt._get_compose_commandline(None, None, 'file%')
32
 
        self.assertEqual(['-a', 'file%'], commandline)
 
31
        commandline = mutt._get_compose_commandline(
 
32
            None, None, 'file%', body="hello")
 
33
        # The temporary filename is randomly generated, so it is not matched.
 
34
        self.assertEqual(['-a', 'file%', '-i'], commandline[:-1])
33
35
        commandline = mutt._get_compose_commandline('jrandom@example.org',
34
36
                                                     'Hi there!', None)
35
37
        self.assertEqual(['-s', 'Hi there!', '--', 'jrandom@example.org'],
191
193
    def test_commandline(self):
192
194
        claws = mail_client.Claws(None)
193
195
        commandline = claws._get_compose_commandline(
194
 
            None, None, 'file%')
 
196
            'jrandom@example.org', None, 'file%')
195
197
        self.assertEqual(
196
 
            ['--compose', 'mailto:?', '--attach', 'file%'], commandline)
 
198
            ['--compose', 'mailto:jrandom@example.org?', '--attach', 'file%'],
 
199
            commandline)
197
200
        commandline = claws._get_compose_commandline(
198
201
            'jrandom@example.org', 'Hi there!', None)
199
202
        self.assertEqual(
217
220
            self.assertFalse(isinstance(item, unicode),
218
221
                'Command-line item %r is unicode!' % item)
219
222
 
 
223
    def test_with_from(self):
 
224
        claws = mail_client.Claws(None)
 
225
        cmdline = claws._get_compose_commandline(
 
226
            u'jrandom@example.org', None, None, None, u'qrandom@example.com')
 
227
        self.assertEqual(
 
228
            ['--compose',
 
229
             'mailto:jrandom@example.org?from=qrandom%40example.com'],
 
230
            cmdline)
 
231
 
 
232
    def test_to_required(self):
 
233
        claws = mail_client.Claws(None)
 
234
        self.assertRaises(errors.NoMailAddressSpecified,
 
235
                          claws._get_compose_commandline,
 
236
                          None, None, 'file%')
 
237
 
 
238
    def test_with_body(self):
 
239
        claws = mail_client.Claws(None)
 
240
        cmdline = claws._get_compose_commandline(
 
241
            u'jrandom@example.org', None, None, 'This is some body text')
 
242
        self.assertEqual(
 
243
            ['--compose',
 
244
             'mailto:jrandom@example.org?body=This%20is%20some%20body%20text'],
 
245
            cmdline)
 
246
 
220
247
 
221
248
class TestEditor(tests.TestCase):
222
249