2876
class TestRepositoryWriteGroups(TestRemoteRepository):
2878
def test_start_write_group(self):
2879
transport_path = 'quack'
2880
repo, client = self.setup_fake_client_and_repository(transport_path)
2881
client.add_expected_call(
2882
'Repository.lock_write', ('quack/', ''),
2883
'success', ('ok', 'a token'))
2884
client.add_expected_call(
2885
'Repository.start_write_group', ('quack/', 'a token'),
2886
'success', ('ok', 'token1'))
2888
repo.start_write_group()
2890
def test_start_write_group_unsuspendable(self):
2891
# Some repositories do not support suspending write
2892
# groups. For those, fall back to the "real" repository.
2893
transport_path = 'quack'
2894
repo, client = self.setup_fake_client_and_repository(transport_path)
2895
def stub_ensure_real():
2896
client._calls.append(('_ensure_real',))
2897
repo._real_repository = _StubRealPackRepository(client._calls)
2898
repo._ensure_real = stub_ensure_real
2899
client.add_expected_call(
2900
'Repository.lock_write', ('quack/', ''),
2901
'success', ('ok', 'a token'))
2902
client.add_expected_call(
2903
'Repository.start_write_group', ('quack/', 'a token'),
2904
'error', ('UnsuspendableWriteGroup',))
2906
repo.start_write_group()
2907
self.assertEquals(client._calls[-2:], [
2909
('start_write_group',)])
2911
def test_commit_write_group(self):
2912
transport_path = 'quack'
2913
repo, client = self.setup_fake_client_and_repository(transport_path)
2914
client.add_expected_call(
2915
'Repository.lock_write', ('quack/', ''),
2916
'success', ('ok', 'a token'))
2917
client.add_expected_call(
2918
'Repository.start_write_group', ('quack/', 'a token'),
2919
'success', ('ok', ['token1']))
2920
client.add_expected_call(
2921
'Repository.commit_write_group', ('quack/', 'a token', ['token1']),
2924
repo.start_write_group()
2925
repo.commit_write_group()
2927
def test_abort_write_group(self):
2928
transport_path = 'quack'
2929
repo, client = self.setup_fake_client_and_repository(transport_path)
2930
client.add_expected_call(
2931
'Repository.lock_write', ('quack/', ''),
2932
'success', ('ok', 'a token'))
2933
client.add_expected_call(
2934
'Repository.start_write_group', ('quack/', 'a token'),
2935
'success', ('ok', ['token1']))
2936
client.add_expected_call(
2937
'Repository.abort_write_group', ('quack/', 'a token', ['token1']),
2940
repo.start_write_group()
2941
repo.abort_write_group(False)
2943
def test_suspend_write_group(self):
2944
transport_path = 'quack'
2945
repo, client = self.setup_fake_client_and_repository(transport_path)
2946
self.assertEquals([], repo.suspend_write_group())
2948
def test_resume_write_group(self):
2949
transport_path = 'quack'
2950
repo, client = self.setup_fake_client_and_repository(transport_path)
2951
client.add_expected_call(
2952
'Repository.lock_write', ('quack/', ''),
2953
'success', ('ok', 'a token'))
2954
client.add_expected_call(
2955
'Repository.check_write_group', ('quack/', 'a token', ['token1']),
2958
repo.resume_write_group(['token1'])
2883
2961
class TestRepositorySetMakeWorkingTrees(TestRemoteRepository):
2885
2963
def test_backwards_compat(self):