~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Vincent Ladeuil
  • Date: 2010-04-22 10:20:40 UTC
  • mfrom: (5050.3.4 2.2)
  • mto: This revision was merged to the branch mainline in revision 5173.
  • Revision ID: v.ladeuil+lp@free.fr-20100422102040-3nv01vm15i8qjip0
Merge 2.2 into bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
418
418
        # Calling _remember_remote_is_before again with a lower value works.
419
419
        client_medium._remember_remote_is_before((1, 5))
420
420
        self.assertTrue(client_medium._is_remote_before((1, 5)))
421
 
        # If you call _remember_remote_is_before with a higher value it logs a
422
 
        # warning, and continues to remember the lower value.
423
 
        self.assertNotContainsRe(self.get_log(), '_remember_remote_is_before')
424
 
        client_medium._remember_remote_is_before((1, 9))
425
 
        self.assertContainsRe(self.get_log(), '_remember_remote_is_before')
426
 
        self.assertTrue(client_medium._is_remote_before((1, 5)))
 
421
        # You cannot call _remember_remote_is_before with a larger value.
 
422
        self.assertRaises(
 
423
            AssertionError, client_medium._remember_remote_is_before, (1, 9))
427
424
 
428
425
 
429
426
class TestBzrDirCloningMetaDir(TestRemote):
531
528
        self.assertIsInstance(bd, RemoteBzrDir)
532
529
        self.assertFinished(client)
533
530
 
534
 
    def test_backwards_compat_hpss_v2(self):
535
 
        client, transport = self.make_fake_client_and_transport()
536
 
        # Monkey-patch fake client to simulate real-world behaviour with v2
537
 
        # server: upon first RPC call detect the protocol version, and because
538
 
        # the version is 2 also do _remember_remote_is_before((1, 6)) before
539
 
        # continuing with the RPC.
540
 
        orig_check_call = client._check_call
541
 
        def check_call(method, args):
542
 
            client._medium._protocol_version = 2
543
 
            client._medium._remember_remote_is_before((1, 6))
544
 
            client._check_call = orig_check_call
545
 
            client._check_call(method, args)
546
 
        client._check_call = check_call
547
 
        client.add_expected_call(
548
 
            'BzrDir.open_2.1', ('quack/',), 'unknown', ('BzrDir.open_2.1',))
549
 
        client.add_expected_call(
550
 
            'BzrDir.open', ('quack/',), 'success', ('yes',))
551
 
        bd = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
552
 
            _client=client, _force_probe=True)
553
 
        self.assertIsInstance(bd, RemoteBzrDir)
554
 
        self.assertFinished(client)
555
 
 
556
531
 
557
532
class TestBzrDirOpenBranch(TestRemote):
558
533