/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 breezy/tests/test_remote.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
    def test_find_correct_format(self):
134
134
        """Should open a RemoteBzrDir over a RemoteTransport"""
135
135
        fmt = BzrDirFormat.find_format(self.transport)
136
 
        self.assertIn(RemoteBzrProber, controldir.ControlDirFormat._probers)
 
136
        self.assertTrue(RemoteBzrProber
 
137
                        in controldir.ControlDirFormat._server_probers)
137
138
        self.assertIsInstance(fmt, RemoteBzrDirFormat)
138
139
 
139
140
    def test_open_detected_smart_format(self):
2861
2862
        somerev1.timezone = -60
2862
2863
        somerev1.inventory_sha1 = b"691b39be74c67b1212a75fcb19c433aaed903c2b"
2863
2864
        somerev1.message = "Message"
2864
 
        body = zlib.compress(b''.join(chk_bencode_serializer.write_revision_to_lines(
2865
 
            somerev1)))
 
2865
        body = zlib.compress(chk_bencode_serializer.write_revision_to_string(
 
2866
            somerev1))
2866
2867
        # Split up body into two bits to make sure the zlib compression object
2867
2868
        # gets data fed twice.
2868
2869
        client.add_success_response_with_body(
3536
3537
 
3537
3538
        def inventories_substream():
3538
3539
            # An empty inventory fulltext.  This will be streamed normally.
3539
 
            chunks = fmt._serializer.write_inventory_to_lines(inv)
3540
 
            yield versionedfile.ChunkedContentFactory(
3541
 
                (b'rev1',), (), None, chunks, chunks_are_lines=True)
 
3540
            text = fmt._serializer.write_inventory_to_string(inv)
 
3541
            yield versionedfile.FulltextContentFactory(
 
3542
                (b'rev1',), (), None, text)
3542
3543
 
3543
3544
        def inventory_delta_substream():
3544
3545
            # An inventory delta.  This can't be streamed via this verb, so it
4529
4530
            (b'baserevid', b'line 1\n'),
4530
4531
            (b'somerevid', b'line2\n')],
4531
4532
            list(tree.annotate_iter('filename')))
4532
 
 
4533
 
 
4534
 
class TestBranchGetAllReferenceInfo(RemoteBranchTestCase):
4535
 
 
4536
 
    def test_get_all_reference_info(self):
4537
 
        transport = MemoryTransport()
4538
 
        client = FakeClient(transport.base)
4539
 
        client.add_expected_call(
4540
 
            b'Branch.get_stacked_on_url', (b'quack/',),
4541
 
            b'error', (b'NotStacked',))
4542
 
        client.add_expected_call(
4543
 
            b'Branch.get_all_reference_info', (b'quack/',),
4544
 
            b'success', (b'ok',), bencode.bencode([
4545
 
                (b'file-id', b'https://www.example.com/', b'')]))
4546
 
        transport.mkdir('quack')
4547
 
        transport = transport.clone('quack')
4548
 
        branch = self.make_remote_branch(transport, client)
4549
 
        result = branch._get_all_reference_info()
4550
 
        self.assertFinished(client)
4551
 
        self.assertEqual({b'file-id': ('https://www.example.com/', None)}, result)