~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_mail_client.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
import urllib
18
18
 
56
56
        self.assertEqual(['-compose', "attachment='%s'" %
57
57
                          urlutils.local_path_to_url('file%')], commandline)
58
58
        commandline = tbird._get_compose_commandline('jrandom@example.org',
59
 
                                                     'Hi there!', None)
60
 
        self.assertEqual(['-compose', "subject='Hi there!',"
61
 
                                      "to='jrandom@example.org'"], commandline)
 
59
                                                     'Hi there!', None,
 
60
                                                     "bo'dy")
 
61
        self.assertEqual(['-compose', "body=bo%27dy,"
 
62
                                      "subject='Hi there!',"
 
63
                                      "to='jrandom@example.org'"],
 
64
                                      commandline)
62
65
 
63
66
    def test_commandline_is_8bit(self):
64
67
        # test for bug #139318
119
122
        self.assertEqual(['jrandom@example.org', '--attach', 'file%'],
120
123
                         commandline)
121
124
        commandline = xdg_email._get_compose_commandline(
122
 
            'jrandom@example.org', 'Hi there!', None)
123
 
        self.assertEqual(['jrandom@example.org', '--subject', 'Hi there!'],
124
 
                         commandline)
 
125
            'jrandom@example.org', 'Hi there!', None, "bo'dy")
 
126
        self.assertEqual(['jrandom@example.org', '--subject', 'Hi there!',
 
127
                          '--body', "bo'dy"], commandline)
125
128
 
126
129
    def test_commandline_is_8bit(self):
127
130
        xdg_email = mail_client.XDGEmail(None)
143
146
        commandline = evo._get_compose_commandline(None, None, 'file%')
144
147
        self.assertEqual(['mailto:?attach=file%25'], commandline)
145
148
        commandline = evo._get_compose_commandline('jrandom@example.org',
146
 
                                                   'Hi there!', None)
147
 
        self.assertEqual(['mailto:jrandom@example.org?subject=Hi%20there%21'],
148
 
                         commandline)
 
149
                                                   'Hi there!', None, 'bo&dy')
 
150
        self.assertEqual(['mailto:jrandom@example.org?body=bo%26dy&'
 
151
                          'subject=Hi%20there%21'], commandline)
149
152
 
150
153
    def test_commandline_is_8bit(self):
151
154
        evo = mail_client.Evolution(None)
257
260
                                     basename=basename)
258
261
        dummy_client = client.client
259
262
        self.assertEqual(dummy_client.args, (to, subject, directive))
260
 
        self.assertEqual(dummy_client.kwargs, {"basename":basename})
 
263
        self.assertEqual(dummy_client.kwargs,
 
264
                         {"basename": basename, 'body': None})