~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

Fix some test failures caused by the switch from unicode to UTF-8-encoded strs for revision IDs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
        r1 = tree.commit('1st commit')
175
175
        r2 = tree.commit('2nd commit', rev_id=u'\xc8')
176
176
        tree.unlock()
177
 
        self.assertEqual(SmartServerResponse(('ok', ),
178
 
            ('\x00'.join([r1, r2])).encode('utf8')),
 
177
        self.assertEqual(
 
178
            SmartServerResponse(('ok', ), ('\x00'.join([r1, r2]))),
179
179
            request.execute(backing.local_abspath('')))
180
180
 
181
181
 
216
216
        tree = self.make_branch_and_memory_tree('.')
217
217
        tree.lock_write()
218
218
        tree.add('')
 
219
        rev_id = u'\xc8'
 
220
        rev_id_utf8 = rev_id.encode('utf-8')
219
221
        r1 = tree.commit('1st commit')
220
 
        r2 = tree.commit('2nd commit', rev_id=u'\xc8')
 
222
        r2 = tree.commit('2nd commit', rev_id=rev_id)
221
223
        tree.unlock()
222
224
        self.assertEqual(
223
 
            SmartServerResponse(('ok', '2', u'\xc8'.encode('utf8'))),
 
225
            SmartServerResponse(('ok', '2', rev_id_utf8)),
224
226
            request.execute(backing.local_abspath('')))
225
227
 
226
228
 
283
285
        tree = self.make_branch_and_memory_tree('.')
284
286
        tree.lock_write()
285
287
        tree.add('')
286
 
        r1 = tree.commit('1st commit', rev_id=u'\xc8')
 
288
        rev_id = u'\xc8'
 
289
        rev_id_utf8 = rev_id.encode('utf-8')
 
290
        r1 = tree.commit('1st commit', rev_id=rev_id)
287
291
        r2 = tree.commit('2nd commit')
288
292
        tree.unlock()
289
293
        branch_token, repo_token = tree.branch.lock_write()
292
296
                SmartServerResponse(('ok',)),
293
297
                request.execute(
294
298
                    backing.local_abspath(''), branch_token, repo_token,
295
 
                    u'\xc8'.encode('utf8')))
296
 
            self.assertEqual([u'\xc8'], tree.branch.revision_history())
 
299
                    rev_id_utf8))
 
300
            self.assertEqual([rev_id_utf8], tree.branch.revision_history())
297
301
        finally:
298
302
            tree.branch.unlock()
299
303
 
303
307
        tree = self.make_branch_and_memory_tree('.')
304
308
        tree.lock_write()
305
309
        tree.add('')
306
 
        r1 = tree.commit('1st commit', rev_id=u'\xc8')
 
310
        rev_id = u'\xc8'
 
311
        rev_id_utf8 = rev_id.encode('utf-8')
 
312
        r1 = tree.commit('1st commit', rev_id=rev_id)
307
313
        r2 = tree.commit('2nd commit')
308
314
        tree.unlock()
309
315
        tree.branch.set_revision_history([])
313
319
                SmartServerResponse(('ok',)),
314
320
                request.execute(
315
321
                    backing.local_abspath(''), branch_token, repo_token,
316
 
                    u'\xc8'.encode('utf8')))
317
 
            self.assertEqual([u'\xc8'], tree.branch.revision_history())
 
322
                    rev_id_utf8))
 
323
            self.assertEqual([rev_id_utf8], tree.branch.revision_history())
318
324
        finally:
319
325
            tree.branch.unlock()
320
326
 
476
482
        response = request.execute(backing.local_abspath(''), '')
477
483
        response.body = '\n'.join(sorted(response.body.split('\n')))
478
484
 
479
 
        self.assertEqual(SmartServerResponse(('ok', ),
480
 
            '\n'.join(lines).encode('utf8')),
481
 
            response)
 
485
        self.assertEqual(
 
486
            SmartServerResponse(('ok', ), '\n'.join(lines)), response)
482
487
 
483
488
    def test_specific_revision_argument(self):
484
489
        backing = self.get_transport()