瀏覽代碼

Closes #191: Webdav copy error - tracim copy at root level instead of choosen folder

Bastien Sevajol (Algoo) 7 年之前
父節點
當前提交
b97c64ce3a
共有 2 個文件被更改,包括 43 次插入1 次删除
  1. 1 1
      tracim/tracim/lib/webdav/sql_resources.py
  2. 42 0
      tracim/tracim/tests/library/test_webdav.py

+ 1 - 1
tracim/tracim/lib/webdav/sql_resources.py 查看文件

@@ -988,7 +988,7 @@ class File(DAVNonCollection):
988 988
                 destination_parent = self.provider.get_parent_from_path(
989 989
                     destpath,
990 990
                     content_api,
991
-                    workspace,
991
+                    destination_workspace,
992 992
                 )
993 993
 
994 994
                 self.content_api.move(

+ 42 - 0
tracim/tracim/tests/library/test_webdav.py 查看文件

@@ -452,6 +452,48 @@ class TestWebDav(TestStandard):
452 452
             )
453 453
         )
454 454
 
455
+    def test_unit__move_content__ok__another_workspace(self):
456
+        provider = self._get_provider()
457
+        environ = self._get_environ(
458
+            provider,
459
+            'bob@fsf.local',
460
+        )
461
+        content_to_move_res = provider.getResourceInst(
462
+            '/w1/w1f1/w1f1d1.txt',
463
+            environ,
464
+        )
465
+
466
+        content_to_move = DBSession.query(ContentRevisionRO) \
467
+            .filter(Content.label == 'w1f1d1') \
468
+            .one()  # It must exist only one revision, cf fixtures
469
+        ok_(content_to_move, msg='w1f1d1 should be exist')
470
+        content_to_move_id = content_to_move.content_id
471
+        content_to_move_parent = content_to_move.parent
472
+        eq_(
473
+            content_to_move_parent.label,
474
+            'w1f1',
475
+            msg='field parent should be w1f1',
476
+        )
477
+
478
+        content_to_move_res.moveRecursive('/w2/w2f1/w1f1d1.txt')  # move in w2, f1
479
+
480
+        # Database content is moved
481
+        content_to_move = DBSession.query(ContentRevisionRO) \
482
+            .filter(ContentRevisionRO.content_id == content_to_move_id) \
483
+            .order_by(ContentRevisionRO.revision_id.desc()) \
484
+            .first()
485
+
486
+        ok_(
487
+            content_to_move.parent,
488
+            msg='Content should have a parent'
489
+        )
490
+        ok_(
491
+            content_to_move.parent.label == 'w2f1',
492
+            msg='file should be moved in w2f1 but is in {0}'.format(
493
+                content_to_move.parent.label
494
+            )
495
+        )
496
+
455 497
     def test_unit__update_content__ok(self):
456 498
         provider = self._get_provider()
457 499
         environ = self._get_environ(