~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 Canonical Ltd
 
1
# Copyright (C) 2006-2013, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
556
556
        a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
557
557
            _client=client)
558
558
        result = a_bzrdir.get_branches()
559
 
        self.assertEquals(set(["", "foo"]), set(result.keys()))
 
559
        self.assertEqual(set(["", "foo"]), set(result.keys()))
560
560
        self.assertEqual(
561
561
            [('call_expecting_body', 'BzrDir.get_branches', ('quack/',)),
562
562
             ('call', 'BzrDir.find_repositoryV3', ('quack/', )),
2124
2124
        transport.mkdir('quack')
2125
2125
        transport = transport.clone('quack')
2126
2126
        branch = self.make_remote_branch(transport, client)
2127
 
        self.assertEquals(0, branch.revision_id_to_revno('null:'))
 
2127
        self.assertEqual(0, branch.revision_id_to_revno('null:'))
2128
2128
        self.assertRaises(errors.NoSuchRevision,
2129
2129
            branch.revision_id_to_revno, 'unknown')
2130
2130
        self.assertFinished(client)
2144
2144
        transport.mkdir('quack')
2145
2145
        transport = transport.clone('quack')
2146
2146
        branch = self.make_remote_branch(transport, client)
2147
 
        self.assertEquals((0, ), branch.revision_id_to_dotted_revno('null:'))
 
2147
        self.assertEqual((0, ), branch.revision_id_to_dotted_revno('null:'))
2148
2148
        self.assertRaises(errors.NoSuchRevision,
2149
2149
            branch.revision_id_to_dotted_revno, 'unknown')
2150
2150
        self.assertFinished(client)
2154
2154
        branch = self.make_branch('.')
2155
2155
        self.disable_verb('Branch.revision_id_to_revno')
2156
2156
        self.reset_smart_call_log()
2157
 
        self.assertEquals((0, ),
 
2157
        self.assertEqual((0, ),
2158
2158
            branch.revision_id_to_dotted_revno('null:'))
2159
2159
        self.assertLength(8, self.hpss_calls)
2160
2160
 
2327
2327
        transport_path = 'quack'
2328
2328
        repo, client = self.setup_fake_client_and_repository(transport_path)
2329
2329
        client.add_success_response_with_body('', 'ok')
2330
 
        self.assertEquals([], repo.all_revision_ids())
 
2330
        self.assertEqual([], repo.all_revision_ids())
2331
2331
        self.assertEqual(
2332
2332
            [('call_expecting_body', 'Repository.all_revision_ids',
2333
2333
             ('quack/',))],
2338
2338
        repo, client = self.setup_fake_client_and_repository(transport_path)
2339
2339
        client.add_success_response_with_body(
2340
2340
            'rev1\nrev2\nanotherrev\n', 'ok')
2341
 
        self.assertEquals(["rev1", "rev2", "anotherrev"],
 
2341
        self.assertEqual(["rev1", "rev2", "anotherrev"],
2342
2342
            repo.all_revision_ids())
2343
2343
        self.assertEqual(
2344
2344
            [('call_expecting_body', 'Repository.all_revision_ids',
2422
2422
        transport_path = 'hill'
2423
2423
        repo, client = self.setup_fake_client_and_repository(transport_path)
2424
2424
        client.add_success_response('ok', '7')
2425
 
        self.assertEquals('7', repo.get_serializer_format())
 
2425
        self.assertEqual('7', repo.get_serializer_format())
2426
2426
        self.assertEqual(
2427
2427
            [('call', 'VersionedFileRepository.get_serializer_format',
2428
2428
              ('hill/', ))],
2446
2446
             ('call_expecting_body', 'Repository.reconcile',
2447
2447
                ('hill/', 'a token'))],
2448
2448
            client._calls)
2449
 
        self.assertEquals(2, reconciler.garbage_inventories)
2450
 
        self.assertEquals(3, reconciler.inconsistent_parents)
 
2449
        self.assertEqual(2, reconciler.garbage_inventories)
 
2450
        self.assertEqual(3, reconciler.inconsistent_parents)
2451
2451
 
2452
2452
 
2453
2453
class TestRepositoryGetRevisionSignatureText(TestRemoteRepository):
2458
2458
        repo, client = self.setup_fake_client_and_repository(transport_path)
2459
2459
        client.add_success_response_with_body(
2460
2460
            'THETEXT', 'ok')
2461
 
        self.assertEquals("THETEXT", repo.get_signature_text("revid"))
 
2461
        self.assertEqual("THETEXT", repo.get_signature_text("revid"))
2462
2462
        self.assertEqual(
2463
2463
            [('call_expecting_body', 'Repository.get_revision_signature_text',
2464
2464
             ('quack/', 'revid'))],
2771
2771
        client.add_success_response_with_body(
2772
2772
                [body[:10], body[10:]], 'ok', '10')
2773
2773
        revs = repo.get_revisions(['somerev1'])
2774
 
        self.assertEquals(revs, [somerev1])
 
2774
        self.assertEqual(revs, [somerev1])
2775
2775
        self.assertEqual(
2776
2776
            [('call_with_body_bytes_expecting_body', 'Repository.iter_revisions',
2777
2777
             ('quack/', ), "somerev1")],
3098
3098
            'error', ('UnsuspendableWriteGroup',))
3099
3099
        repo.lock_write()
3100
3100
        repo.start_write_group()
3101
 
        self.assertEquals(client._calls[-2:], [ 
 
3101
        self.assertEqual(client._calls[-2:], [ 
3102
3102
            ('_ensure_real',),
3103
3103
            ('start_write_group',)])
3104
3104
 
3137
3137
    def test_suspend_write_group(self):
3138
3138
        transport_path = 'quack'
3139
3139
        repo, client = self.setup_fake_client_and_repository(transport_path)
3140
 
        self.assertEquals([], repo.suspend_write_group())
 
3140
        self.assertEqual([], repo.suspend_write_group())
3141
3141
 
3142
3142
    def test_resume_write_group(self):
3143
3143
        transport_path = 'quack'
3227
3227
            'success', ('ok',), iter(["ok\x000", "\n", zlib.compress("mydata" * 10)]))
3228
3228
        for (identifier, byte_stream) in repo.iter_files_bytes([("somefile",
3229
3229
                "somerev", "myid")]):
3230
 
            self.assertEquals("myid", identifier)
3231
 
            self.assertEquals("".join(byte_stream), "mydata" * 10)
 
3230
            self.assertEqual("myid", identifier)
 
3231
            self.assertEqual("".join(byte_stream), "mydata" * 10)
3232
3232
 
3233
3233
    def test_missing(self):
3234
3234
        transport_path = 'quack'
4154
4154
    def assertUpdateSucceeds(self, new_location):
4155
4155
        self.checkout.branch.set_bound_location(new_location)
4156
4156
        self.checkout.update()
4157
 
        self.assertEquals(self.last_revid, self.checkout.last_revision())
 
4157
        self.assertEqual(self.last_revid, self.checkout.last_revision())
4158
4158
 
4159
4159
    def test_without_final_slash(self):
4160
4160
        self.make_master_and_checkout('master', 'checkout')
4276
4276
        ret = list(repo.iter_inventories(["somerevid"]))
4277
4277
        self.assertLength(1, ret)
4278
4278
        inv = ret[0]
4279
 
        self.assertEquals("somerevid", inv.revision_id)
 
4279
        self.assertEqual("somerevid", inv.revision_id)
4280
4280
 
4281
4281
    def test_empty(self):
4282
4282
        transport_path = 'quack'
4283
4283
        repo, client = self.setup_fake_client_and_repository(transport_path)
4284
4284
        ret = list(repo.iter_inventories([]))
4285
 
        self.assertEquals(ret, [])
 
4285
        self.assertEqual(ret, [])
4286
4286
 
4287
4287
    def test_missing(self):
4288
4288
        transport_path = 'quack'