379
378
class TestResolveContentsConflict(TestParametrizedResolveConflicts):
380
_conflict_type = conflicts.ContentsConflict,
382
382
def scenarios(klass):
383
common = dict(_actions_base='create_file',
384
_item_path='file', item_id='file-id',
383
386
base_scenarios = [
384
387
(('file_modified', dict(actions='modify_file',
385
388
check='file_has_more_content')),
386
389
('file_deleted', dict(actions='delete_file',
387
390
check='file_doesnt_exist'))),
389
common = dict(_conflict_type=conflicts.ContentsConflict,
390
_actions_base='create_file',
391
_assert_conflict='assertContentsConflict',
392
_item_path='file', item_id='file-id',
394
return klass.mirror_scenarios(base_scenarios, common)
392
return klass.mirror_scenarios(common, base_scenarios)
396
394
def assertContentsConflict(self, c):
397
395
self.assertEqual(self._other_id, c.file_id)
398
396
self.assertEqual(self._other_path, c.path)
397
_assert_conflict = assertContentsConflict
401
401
class TestResolvePathConflict(TestParametrizedResolveConflicts):
403
_conflict_type = conflicts.PathConflict,
404
406
def scenarios(klass):
407
common = dict(_actions_base='create_dir',
408
_item_path='new-dir', _item_id='dir-id',)
405
409
base_scenarios = [
406
410
(('dir_renamed', dict(actions='rename_dir', check='dir_renamed')),
407
411
('dir_deleted', dict(actions='delete_dir', check='dir_doesnt_exist'))),
408
412
(('dir_renamed', dict(actions='rename_dir', check='dir_renamed')),
409
413
('dir_renamed2', dict(actions='rename_dir2', check='dir_renamed2'))),
411
common = dict(_conflict_type=conflicts.PathConflict,
412
_assert_conflict='assert_PathConflict',
413
_actions_base='create_dir',
414
_item_path='new-dir', _item_id='dir-id',)
415
return klass.mirror_scenarios(base_scenarios, common)
415
return klass.mirror_scenarios(common, base_scenarios)
417
def assert_PathConflict(self, c):
417
def assertPathConflict(self, c):
418
418
self.assertEqual(self._item_id, c.file_id)
419
419
self.assertEqual(self._this_path, c.path)
420
420
self.assertEqual(self._other_path, c.conflict_path)
421
_assert_conflict = assertPathConflict
423
424
class TestResolvePathConflictBefore531967(TestParametrizedResolveConflicts):
427
428
# FIXME: Now that bug #531697 is fixed, we need to inject a conflict object
428
429
# as it existed before the fix.
430
def assert_PathConflict(self, c):
431
def assertPathConflict(self, c):
431
432
# bug #531967 is about file_id not being set in some cases
432
433
self.assertIs(None, c.file_id)
433
434
# Whatever this and other are saying, the same paths are used