~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-14 17:18:23 UTC
  • mfrom: (5536.2.9 fetch-dev-docs)
  • Revision ID: pqm@pqm.ubuntu.com-20110114171823-5gx64sero62ag6r4
(jelmer) Add a developer doc on the topic of fetch. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1469
1469
            request.execute('stacked', 1, (3, r3)))
1470
1470
 
1471
1471
 
1472
 
class TestSmartServerRepositoryGetStream(tests.TestCaseWithMemoryTransport):
 
1472
class GetStreamTestBase(tests.TestCaseWithMemoryTransport):
1473
1473
 
1474
1474
    def make_two_commit_repo(self):
1475
1475
        tree = self.make_branch_and_memory_tree('.')
1481
1481
        repo = tree.branch.repository
1482
1482
        return repo, r1, r2
1483
1483
 
 
1484
 
 
1485
class TestSmartServerRepositoryGetStream(GetStreamTestBase):
 
1486
 
1484
1487
    def test_ancestry_of(self):
1485
1488
        """The search argument may be a 'ancestry-of' some heads'."""
1486
1489
        backing = self.get_transport()
1507
1510
        stream_bytes = ''.join(response.body_stream)
1508
1511
        self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
1509
1512
 
 
1513
    def test_search_everything(self):
 
1514
        """A search of 'everything' returns a stream."""
 
1515
        backing = self.get_transport()
 
1516
        request = smart_repo.SmartServerRepositoryGetStream_1_19(backing)
 
1517
        repo, r1, r2 = self.make_two_commit_repo()
 
1518
        serialised_fetch_spec = 'everything'
 
1519
        request.execute('', repo._format.network_name())
 
1520
        response = request.do_body(serialised_fetch_spec)
 
1521
        self.assertEqual(('ok',), response.args)
 
1522
        stream_bytes = ''.join(response.body_stream)
 
1523
        self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
 
1524
 
1510
1525
 
1511
1526
class TestSmartServerRequestHasRevision(tests.TestCaseWithMemoryTransport):
1512
1527
 
1906
1921
            smart_repo.SmartServerRepositoryGetRevisionGraph)
1907
1922
        self.assertHandlerEqual('Repository.get_stream',
1908
1923
            smart_repo.SmartServerRepositoryGetStream)
 
1924
        self.assertHandlerEqual('Repository.get_stream_1.19',
 
1925
            smart_repo.SmartServerRepositoryGetStream_1_19)
1909
1926
        self.assertHandlerEqual('Repository.has_revision',
1910
1927
            smart_repo.SmartServerRequestHasRevision)
1911
1928
        self.assertHandlerEqual('Repository.insert_stream',