/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_fetch.py

merge bzr.dev r4164

Show diffs side-by-side

added added

removed removed

Lines of Context:
330
330
 
331
331
class TestKnitToPackFetch(TestCaseWithTransport):
332
332
 
333
 
    def find_get_record_stream(self, calls):
334
 
        """In a list of calls, find 'get_record_stream' calls.
 
333
    def find_get_record_stream(self, calls, expected_count=1):
 
334
        """In a list of calls, find the last 'get_record_stream'.
335
335
 
336
 
        This also ensures that there is only one get_record_stream call.
 
336
        :param expected_count: The number of calls we should exepect to find.
 
337
            If a different number is found, an assertion is raised.
337
338
        """
338
339
        get_record_call = None
 
340
        call_count = 0
339
341
        for call in calls:
340
342
            if call[0] == 'get_record_stream':
341
 
                self.assertIs(None, get_record_call,
342
 
                              "there should only be one call to"
343
 
                              " get_record_stream")
 
343
                call_count += 1
344
344
                get_record_call = call
345
 
        self.assertIsNot(None, get_record_call,
346
 
                         "there should be exactly one call to "
347
 
                         " get_record_stream")
 
345
        self.assertEqual(expected_count, call_count)
348
346
        return get_record_call
349
347
 
350
348
    def test_fetch_with_deltas_no_delta_closure(self):
370
368
                          target._format._fetch_order, False),
371
369
                         self.find_get_record_stream(source.texts.calls))
372
370
        self.assertEqual(('get_record_stream', [('rev-one',)],
373
 
                          target._format._fetch_order, False),
374
 
                         self.find_get_record_stream(source.inventories.calls))
 
371
          target._format._fetch_order, False),
 
372
          self.find_get_record_stream(source.inventories.calls, 2))
375
373
        self.assertEqual(('get_record_stream', [('rev-one',)],
376
374
                          target._format._fetch_order, False),
377
375
                         self.find_get_record_stream(source.revisions.calls))
414
412
                          target._format._fetch_order, True),
415
413
                         self.find_get_record_stream(source.texts.calls))
416
414
        self.assertEqual(('get_record_stream', [('rev-one',)],
417
 
                          target._format._fetch_order, True),
418
 
                         self.find_get_record_stream(source.inventories.calls))
 
415
            target._format._fetch_order, True),
 
416
            self.find_get_record_stream(source.inventories.calls, 2))
419
417
        self.assertEqual(('get_record_stream', [('rev-one',)],
420
418
                          target._format._fetch_order, True),
421
419
                         self.find_get_record_stream(source.revisions.calls))