~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_mail_client.py

  • Committer: Aaron Bentley
  • Date: 2008-04-24 04:58:42 UTC
  • mfrom: (3377 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3380.
  • Revision ID: aaron@aaronbentley.com-20080424045842-0cajl9v6s4u52kaw
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
                'Command-line item %r is unicode!' % item)
72
72
 
73
73
 
74
 
class TestEmacsMailMode(tests.TestCase):
 
74
class TestEmacsMail(tests.TestCase):
75
75
 
76
76
    def test_commandline(self):
77
 
        eclient = mail_client.EmacsMailMode(None)
78
 
        commandline = eclient._get_compose_commandline(None, None, 'file%')
79
 
        self.assertEqual(['--eval', '(mail nil nil nil)',
80
 
                          '(mail-text)', '(newline)',
81
 
                          '(attach "file%")'], commandline)
 
77
        eclient = mail_client.EmacsMail(None)
 
78
 
 
79
        commandline = eclient._get_compose_commandline(None, 'Hi there!', None)
 
80
        self.assertEqual(['--eval', '(compose-mail nil "Hi there!")'],
 
81
                         commandline)
82
82
 
83
83
        commandline = eclient._get_compose_commandline('jrandom@example.org',
84
 
                                                     'Hi there!', None)
85
 
        self.assertEqual(['--eval', '(mail nil "jrandom@example.org" "Hi there!")',
86
 
                          '(mail-text)', '(newline)'], commandline)
 
84
                                                       'Hi there!', None)
 
85
        self.assertEqual(['--eval',
 
86
                          '(compose-mail "jrandom@example.org" "Hi there!")'],
 
87
                         commandline)
 
88
 
 
89
        # We won't be able to know the temporary file name at this stage
 
90
        # so we can't raise an assertion with assertEqual
 
91
        cmdline = eclient._get_compose_commandline(None, None, 'file%')
 
92
        commandline = ' '.join(cmdline)
 
93
        self.assertContainsRe(commandline, '--eval')
 
94
        self.assertContainsRe(commandline, '(compose-mail nil nil)')
 
95
        self.assertContainsRe(commandline, '(load .*)')
 
96
        self.assertContainsRe(commandline, '(bzr-add-mime-att \"file%\")')
87
97
 
88
98
    def test_commandline_is_8bit(self):
89
 
        eclient = mail_client.EmacsMailMode(None)
 
99
        eclient = mail_client.EmacsMail(None)
90
100
        commandline = eclient._get_compose_commandline(u'jrandom@example.org',
91
101
            u'Hi there!', u'file%')
92
 
        self.assertEqual(['--eval', '(mail nil "jrandom@example.org" "Hi there!")',
93
 
                          '(mail-text)', '(newline)',
94
 
                          '(attach "file%")'], commandline)
95
102
        for item in commandline:
96
103
            self.assertFalse(isinstance(item, unicode),
97
104
                'Command-line item %r is unicode!' % item)