1825
1826
self.assertEqual([], client._calls)
1829
class TestRepositoryInsertStream(TestRemoteRepository):
1831
def test_unlocked_repo(self):
1832
transport_path = 'quack'
1833
repo, client = self.setup_fake_client_and_repository(transport_path)
1834
client.add_expected_call(
1835
'Repository.insert_stream', ('quack/', ''),
1837
client.add_expected_call(
1838
'Repository.insert_stream', ('quack/', ''),
1840
sink = repo._get_sink()
1841
fmt = repository.RepositoryFormat.get_default_format()
1842
resume_tokens, missing_keys = sink.insert_stream([], fmt, [])
1843
self.assertEqual([], resume_tokens)
1844
self.assertEqual(set(), missing_keys)
1845
client.finished_test()
1847
def test_locked_repo_with_no_lock_token(self):
1848
transport_path = 'quack'
1849
repo, client = self.setup_fake_client_and_repository(transport_path)
1850
client.add_expected_call(
1851
'Repository.lock_write', ('quack/', ''),
1852
'success', ('ok', ''))
1853
client.add_expected_call(
1854
'Repository.insert_stream', ('quack/', ''),
1856
client.add_expected_call(
1857
'Repository.insert_stream', ('quack/', ''),
1860
sink = repo._get_sink()
1861
fmt = repository.RepositoryFormat.get_default_format()
1862
resume_tokens, missing_keys = sink.insert_stream([], fmt, [])
1863
self.assertEqual([], resume_tokens)
1864
self.assertEqual(set(), missing_keys)
1865
client.finished_test()
1867
def test_locked_repo_with_lock_token(self):
1868
transport_path = 'quack'
1869
repo, client = self.setup_fake_client_and_repository(transport_path)
1870
client.add_expected_call(
1871
'Repository.lock_write', ('quack/', ''),
1872
'success', ('ok', 'a token'))
1873
client.add_expected_call(
1874
'Repository.insert_stream_locked', ('quack/', '', 'a token'),
1876
client.add_expected_call(
1877
'Repository.insert_stream_locked', ('quack/', '', 'a token'),
1880
sink = repo._get_sink()
1881
fmt = repository.RepositoryFormat.get_default_format()
1882
resume_tokens, missing_keys = sink.insert_stream([], fmt, [])
1883
self.assertEqual([], resume_tokens)
1884
self.assertEqual(set(), missing_keys)
1885
client.finished_test()
1828
1888
class TestRepositoryTarball(TestRemoteRepository):
1830
1890
# This is a canned tarball reponse we can validate against