~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 17:12:46 UTC
  • mto: This revision was merged to the branch mainline in revision 3927.
  • Revision ID: gavin.panella@canonical.com-20090105171246-eq10vn8lrv80a2ao
Use the --attach option, and don't specify a From: header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
 
188
188
    def test_commandline(self):
189
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')],
 
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'],
211
199
            commandline)
212
200
 
213
201
    def test_commandline_is_8bit(self):
216
204
            u'jrandom@example.org', u'Hi there!', u'file%')
217
205
        self.assertEqual(
218
206
            ['--compose',
219
 
             'jrandom@example.org?subject=Hi%20there%21&attach=file%25'],
 
207
             'mailto:jrandom@example.org?subject=Hi%20there%21',
 
208
             '--attach',
 
209
             'file%'],
220
210
            cmdline)
221
211
        for item in cmdline:
222
212
            self.assertFalse(isinstance(item, unicode),