|
@@ -481,6 +481,50 @@ class TestWebDav(TestStandard):
|
481
|
481
|
)
|
482
|
482
|
)
|
483
|
483
|
|
|
484
|
+ def test_unit__move_and_rename_content__ok(self):
|
|
485
|
+ provider = self._get_provider()
|
|
486
|
+ environ = self._get_environ(
|
|
487
|
+ provider,
|
|
488
|
+ 'bob@fsf.local',
|
|
489
|
+ )
|
|
490
|
+ w1f1d1 = provider.getResourceInst(
|
|
491
|
+ '/w1/w1f1/w1f1d1.txt',
|
|
492
|
+ environ,
|
|
493
|
+ )
|
|
494
|
+
|
|
495
|
+ content_w1f1d1 = DBSession.query(ContentRevisionRO) \
|
|
496
|
+ .filter(Content.label == 'w1f1d1') \
|
|
497
|
+ .one() # It must exist only one revision, cf fixtures
|
|
498
|
+ ok_(content_w1f1d1, msg='w1f1d1 should be exist')
|
|
499
|
+ content_w1f1d1_id = content_w1f1d1.content_id
|
|
500
|
+ content_w1f1d1_parent = content_w1f1d1.parent
|
|
501
|
+ eq_(
|
|
502
|
+ content_w1f1d1_parent.label,
|
|
503
|
+ 'w1f1',
|
|
504
|
+ msg='field parent should be w1f1',
|
|
505
|
+ )
|
|
506
|
+
|
|
507
|
+ w1f1d1.moveRecursive('/w1/w1f2/w1f1d1_RENAMED.txt')
|
|
508
|
+
|
|
509
|
+ # Database content is moved
|
|
510
|
+ content_w1f1d1 = DBSession.query(ContentRevisionRO) \
|
|
511
|
+ .filter(ContentRevisionRO.content_id == content_w1f1d1_id) \
|
|
512
|
+ .order_by(ContentRevisionRO.revision_id.desc()) \
|
|
513
|
+ .first()
|
|
514
|
+ ok_(
|
|
515
|
+ content_w1f1d1.parent.label != content_w1f1d1_parent.label,
|
|
516
|
+ msg='file should be moved in w1f2 but is in {0}'.format(
|
|
517
|
+ content_w1f1d1.parent.label
|
|
518
|
+ )
|
|
519
|
+ )
|
|
520
|
+ eq_(
|
|
521
|
+ 'w1f1d1_RENAMED',
|
|
522
|
+ content_w1f1d1.label,
|
|
523
|
+ msg='File should be labeled w1f1d1_RENAMED, not {0}'.format(
|
|
524
|
+ content_w1f1d1.label
|
|
525
|
+ )
|
|
526
|
+ )
|
|
527
|
+
|
484
|
528
|
def test_unit__move_content__ok__another_workspace(self):
|
485
|
529
|
provider = self._get_provider()
|
486
|
530
|
environ = self._get_environ(
|