1469
1469
request.execute('stacked', 1, (3, r3)))
1472
class TestSmartServerRepositoryGetStream(tests.TestCaseWithMemoryTransport):
1472
class GetStreamTestBase(tests.TestCaseWithMemoryTransport):
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
1485
class TestSmartServerRepositoryGetStream(GetStreamTestBase):
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')
1513
def test_search_does_not_accept_everything(self):
1514
"""The search argument of the <2.3 verb may not be 'everything'."""
1515
backing = self.get_transport()
1516
request = smart_repo.SmartServerRepositoryGetStream(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(('BadSearch',), response.args)
1524
class TestSmartServerRepositoryGetStream_2_3(GetStreamTestBase):
1526
def test_search_everything(self):
1527
"""A search of 'everything' returns a stream."""
1528
backing = self.get_transport()
1529
request = smart_repo.SmartServerRepositoryGetStream_2_3(backing)
1530
repo, r1, r2 = self.make_two_commit_repo()
1531
serialised_fetch_spec = 'everything'
1532
request.execute('', repo._format.network_name())
1533
response = request.do_body(serialised_fetch_spec)
1534
self.assertEqual(('ok',), response.args)
1535
stream_bytes = ''.join(response.body_stream)
1536
self.assertStartsWith(stream_bytes, 'Bazaar pack format 1')
1511
1539
class TestSmartServerRequestHasRevision(tests.TestCaseWithMemoryTransport):
1906
1934
smart_repo.SmartServerRepositoryGetRevisionGraph)
1907
1935
self.assertHandlerEqual('Repository.get_stream',
1908
1936
smart_repo.SmartServerRepositoryGetStream)
1937
self.assertHandlerEqual('Repository.get_stream_1.19',
1938
smart_repo.SmartServerRepositoryGetStream_1_19)
1939
self.assertHandlerEqual('Repository.get_stream_2.3',
1940
smart_repo.SmartServerRepositoryGetStream_2_3)
1909
1941
self.assertHandlerEqual('Repository.has_revision',
1910
1942
smart_repo.SmartServerRequestHasRevision)
1911
1943
self.assertHandlerEqual('Repository.insert_stream',