~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

Move to BzrDir.checkout_metadir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
503
503
        self.assertRaises(errors.UnknownFormatError, a_bzrdir.cloning_metadir)
504
504
 
505
505
 
 
506
class TestBzrDirCheckoutMetaDir(TestRemote):
 
507
 
 
508
    def test__get_checkout_format(self):
 
509
        transport = MemoryTransport()
 
510
        client = FakeClient(transport.base)
 
511
        reference_bzrdir_format = bzrdir.format_registry.get('default')()
 
512
        control_name = reference_bzrdir_format.network_name()
 
513
        client.add_expected_call(
 
514
            'BzrDir.checkout_metadir', ('quack/', ),
 
515
            'success', (control_name, '', ''))
 
516
        transport.mkdir('quack')
 
517
        transport = transport.clone('quack')
 
518
        a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
 
519
            _client=client)
 
520
        result = a_bzrdir.checkout_metadir()
 
521
        # We should have got a reference control dir with default branch and
 
522
        # repository formats.
 
523
        self.assertEqual(bzrdir.BzrDirMetaFormat1, type(result))
 
524
        self.assertEqual(None, result._repository_format)
 
525
        self.assertEqual(None, result._branch_format)
 
526
        self.assertFinished(client)
 
527
 
 
528
    def test_unknown_format(self):
 
529
        transport = MemoryTransport()
 
530
        client = FakeClient(transport.base)
 
531
        client.add_expected_call(
 
532
            'BzrDir.checkout_metadir', ('quack/',),
 
533
            'success', ('dontknow', '', ''))
 
534
        transport.mkdir('quack')
 
535
        transport = transport.clone('quack')
 
536
        a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
 
537
            _client=client)
 
538
        self.assertRaises(errors.UnknownFormatError,
 
539
            a_bzrdir.checkout_metadir)
 
540
        self.assertFinished(client)
 
541
 
 
542
 
506
543
class TestBzrDirDestroyBranch(TestRemote):
507
544
 
508
545
    def test_destroy_default(self):
1102
1139
        self.assertFinished(client)
1103
1140
 
1104
1141
 
1105
 
class TestBranchGetCheckoutFormat(RemoteBranchTestCase):
1106
 
 
1107
 
    def test__get_checkout_format(self):
1108
 
        transport = MemoryTransport()
1109
 
        client = FakeClient(transport.base)
1110
 
        reference_bzrdir_format = bzrdir.format_registry.get('default')()
1111
 
        control_name = reference_bzrdir_format.network_name()
1112
 
        client.add_expected_call(
1113
 
            'Branch.get_stacked_on_url', ('quack/',),
1114
 
            'error', ('NotStacked',))
1115
 
        client.add_expected_call(
1116
 
            'Branch.get_checkout_format', ('quack/', False),
1117
 
            'success', (control_name, '', ''))
1118
 
        transport.mkdir('quack')
1119
 
        transport = transport.clone('quack')
1120
 
        branch = self.make_remote_branch(transport, client)
1121
 
        result = branch._get_checkout_format()
1122
 
        # We should have got a reference control dir with default branch and
1123
 
        # repository formats.
1124
 
        self.assertEqual(bzrdir.BzrDirMetaFormat1, type(result))
1125
 
        self.assertEqual(None, result._repository_format)
1126
 
        self.assertEqual(None, result._branch_format)
1127
 
        self.assertFinished(client)
1128
 
 
1129
 
    def test_unknown_format(self):
1130
 
        transport = MemoryTransport()
1131
 
        client = FakeClient(transport.base)
1132
 
        client.add_expected_call(
1133
 
            'Branch.get_stacked_on_url', ('quack/',),
1134
 
            'error', ('NotStacked',))
1135
 
        client.add_expected_call(
1136
 
            'Branch.get_checkout_format', ('quack/', False),
1137
 
            'success', ('dontknow', '', ''))
1138
 
        transport.mkdir('quack')
1139
 
        transport = transport.clone('quack')
1140
 
        branch = self.make_remote_branch(transport, client)
1141
 
        self.assertRaises(errors.UnknownFormatError,
1142
 
            branch._get_checkout_format)
1143
 
        self.assertFinished(client)
1144
 
 
1145
 
 
1146
1142
class TestBranchGetPhysicalLockStatus(RemoteBranchTestCase):
1147
1143
 
1148
1144
    def test_get_physical_lock_status_yes(self):