~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_merge_directive.py

  • Committer: Robert Collins
  • Date: 2007-06-28 02:43:50 UTC
  • mfrom: (2553 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2558.
  • Revision ID: robertc@robertcollins.net-20070628024350-z8bdm0y6yz2uyf4o
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
        connect_calls = []
110
110
        def connect(self, host='localhost', port=0):
111
111
            connect_calls.append((self, host, port))
 
112
        def starttls(self):
 
113
            pass
112
114
        old_sendmail = smtplib.SMTP.sendmail
113
115
        smtplib.SMTP.sendmail = sendmail
114
116
        old_connect = smtplib.SMTP.connect
115
117
        smtplib.SMTP.connect = connect
 
118
        old_starttls = smtplib.SMTP.starttls
 
119
        smtplib.SMTP.starttls = starttls
116
120
        try:
117
121
            result = self.run_bzr(*args, **kwargs)
118
122
        finally:
119
123
            smtplib.SMTP.sendmail = old_sendmail
120
124
            smtplib.SMTP.connect = old_connect
 
125
            smtplib.SMTP.starttls = old_starttls
121
126
        return result + (connect_calls, sendmail_calls)
122
127
 
123
128
    def test_mail_default(self):
132
137
        self.assertEqual(('localhost', 0), call[1:3])
133
138
        self.assertEqual(1, len(sendmail_calls))
134
139
        call = sendmail_calls[0]
135
 
        self.assertEqual(('J. Random Hacker <jrandom@example.com>',
136
 
                          'pqm@example.com'), call[1:3])
 
140
        self.assertEqual(('jrandom@example.com', ['pqm@example.com']),
 
141
                call[1:3])
137
142
        self.assertContainsRe(call[3], EMAIL1)
138
143
 
139
144
    def test_pull_raw(self):
227
232
        os.chdir('foo')
228
233
        self.run_bzr_error(('No revisions to bundle.', ),
229
234
                            'merge-directive', '../bar')
 
235
 
 
236
    def test_encoding_exact(self):
 
237
        tree1, tree2 = self.prepare_merge_directive()
 
238
        tree1.commit(u'messag\xe9')
 
239
        self.run_bzr('merge-directive', '../tree2') # no exception raised