/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_remote.py

  • Committer: Martin Pool
  • Date: 2007-03-30 03:59:56 UTC
  • mto: (2420.2.2 bzr.http.auth)
  • mto: This revision was merged to the branch mainline in revision 2462.
  • Revision ID: mbp@sourcefrog.net-20070330035956-lmp3z220xq1kdusx
(broken) Start addng client proxy test for Repository.tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
These are proxy objects which act on remote objects by sending messages
20
20
through a smart client.  The proxies are to be created when attempting to open
21
21
the object given a transport that supports smartserver rpc operations. 
 
22
 
 
23
These tests correspond to tests.test_smart, which exercises the server side.
22
24
"""
23
25
 
24
26
from cStringIO import StringIO
366
368
class TestRemoteRepository(tests.TestCase):
367
369
 
368
370
    def setup_fake_client_and_repository(self, responses, transport_path):
369
 
        """Create the fake client and repository for testing with."""
 
371
        """Create the fake client and repository for testing with.
 
372
        
 
373
        There's no real server here; we just have canned responses sent
 
374
        back one by one.
 
375
        
 
376
        :param transport_path: Path below the root of the MemoryTransport
 
377
            where the repository will be created.
 
378
        """
370
379
        client = FakeClient(responses)
371
380
        transport = MemoryTransport()
372
381
        transport.mkdir(transport_path)
600
609
 
601
610
        # The remote repo shouldn't be accessed.
602
611
        self.assertEqual([], client._calls)
 
612
 
 
613
 
 
614
class TestRepositoryTarball(TestRemoteRepository):
 
615
 
 
616
    def test_repository_tarball(self):
 
617
        # it's not easy to construct the full tarball ahead of time, so we
 
618
        # won't use the canned responses 
 
619
        tarball_content = \
 
620
            'BZh91AY&SY\xc7\x94y\xbb\x00\x02\x85\x7f\x83\xc2\x90\x00 H\x03\xff\xc0\x11\x89\xd2\x00\x7f\xef\xdfp@H\x00\x10\x00\x080\x01\x8d\xa5f\x04T\xd4\xa3\xd4\xcd4\x8d\r0#\t\x88\xc26\x80\x01\x14\x82MOP\r\x0c\x87\x924\x00\x03C\xd4=@\xa9BMOB\x06\x9ai\xa1\xa0\x00\x00\x006\x03\xbe\xaa`\xcf33\xe6\x1e\xe4\x89JR\x9dN\xc3\xebK\x035\x00\xa0\\\xb7s\x0bh]\x8c\xb8M\xe3,\xa4\xa5,L\xd2\xfa/\xa5(\xa5\xe4\xc6&r@,\x81\xd2\xc8\x19\x83\xf0\x0c\x80\xe1\x80\xe2~\xf0\xa7+\r\x8f\xe3\x1e;>\x8bh\xa7\r}lM\x81\x9f@\x99\x846\\\xfdU\x95\xed\xec\xba\xdb\xa4/\x13\x83\x02X\x96\x13N\xa2e\x13^\xd7j\xadI\x8a\xa4\xbc\x96+}D\xa0\x06\xdb\xe2#[VT\x95\x19\xddeA\x99HB\xb1d\x86\xd0\'"*%2\x18\x19\x04\xb10\xa9\\D\xb6A\xad\x8b%D\xb1v\x13M\xa5\x7f!#41$y\xe0\xc2\x0e\xba\xb8\x1fF\xa8\x01\xae\xf1\xc7\xe2;\xe89\x9ba\x033\xb2\xcf\x13CK\xe0CY\xa1a\x19p\xa8gg(-\x83P6\xbd\n]#\xba\x02\x86r\x860\xe91\xef\x92\xbb\x11\xc4\x072:\x01\xc1\x8b\x88\xfd\xd6\x99D\x19K#C\x99\x03k\x9e#v\x8f\x03Tl\x07\xac\x9b\xb8@`,ZB3-2\x06\x85\xcfK\r\xea\xd9\x9d\xbc\x17\xfc]\xc9\x14\xe1BC\x1eQ\xe6\xec'
 
621
        transport_path = 'repo'
 
622
        expected_responses = [(('ok',), tarball_content),
 
623
            ]
 
624
        expected_calls = [(('Repository.tarball', '/repo', 'bz2',),),
 
625
            ]
 
626
        remote_repo, client = self.setup_fake_client_and_repository(
 
627
            expected_responses, transport_path)
 
628
        # Now actually ask for the tarball
 
629
        remote_repo._get_tarball('bz2')
 
630
        self.assertEqual(expected_calls, client._calls)
 
631
        
 
632
# TODO: Maybe add tests for Repository.tarball() - a bit hard to test in this
 
633
# framework as it's not 
 
634
 
 
635
    # TODO: Test for error when there's no repository there