Browse Source

Fix tests for simple copy

Guénaël Muller 6 years ago
parent
commit
6891f63f76
1 changed files with 18 additions and 12 deletions
  1. 18 12
      tracim/tracim/tests/library/test_content_api.py

+ 18 - 12
tracim/tracim/tests/library/test_content_api.py View File

425
         )
425
         )
426
         assert text_file != text_file_copy
426
         assert text_file != text_file_copy
427
         assert text_file_copy.content_id != text_file.content_id
427
         assert text_file_copy.content_id != text_file.content_id
428
-        assert text_file_copy.workspace == workspace2
429
-        assert text_file_copy.depot_file != text_file.depot_file
428
+        assert text_file_copy.workspace_id == workspace2.workspace_id
429
+        assert text_file_copy.depot_file.file.read() == text_file.depot_file.file.read()
430
+        assert text_file_copy.depot_file.path != text_file.depot_file.path
430
         assert text_file_copy.label == 'test_file_copy'
431
         assert text_file_copy.label == 'test_file_copy'
431
         assert text_file_copy.type == text_file.type
432
         assert text_file_copy.type == text_file.type
432
-        assert text_file_copy.parent == folderb
433
-        assert text_file_copy.owner == user2
433
+        assert text_file_copy.parent.content_id == folderb.content_id
434
+        assert text_file_copy.owner.user_id == user.user_id
434
         assert text_file_copy.description == text_file.description
435
         assert text_file_copy.description == text_file.description
435
         assert text_file_copy.file_extension == text_file.file_extension
436
         assert text_file_copy.file_extension == text_file.file_extension
436
         assert text_file_copy.file_mimetype == text_file.file_mimetype
437
         assert text_file_copy.file_mimetype == text_file.file_mimetype
438
+        assert text_file_copy.revision_type == ActionDescription.COPY
437
 
439
 
438
     def test_unit_copy_file__same_label_different_parent_ok(self):
440
     def test_unit_copy_file__same_label_different_parent_ok(self):
439
         uapi = UserApi(None)
441
         uapi = UserApi(None)
506
         text_file_copy = api2.get_one_by_label_and_parent('test_file', folderb)
508
         text_file_copy = api2.get_one_by_label_and_parent('test_file', folderb)
507
         assert text_file != text_file_copy
509
         assert text_file != text_file_copy
508
         assert text_file_copy.content_id != text_file.content_id
510
         assert text_file_copy.content_id != text_file.content_id
509
-        assert text_file_copy.workspace == workspace2
510
-        assert text_file_copy.depot_file != text_file.depot_file
511
+        assert text_file_copy.workspace_id == workspace2.workspace_id
512
+        assert text_file_copy.depot_file.file.read() == text_file.depot_file.file.read()
513
+        assert text_file_copy.depot_file.path != text_file.depot_file.path
511
         assert text_file_copy.label == text_file.label
514
         assert text_file_copy.label == text_file.label
512
         assert text_file_copy.type == text_file.type
515
         assert text_file_copy.type == text_file.type
513
-        assert text_file_copy.parent == folderb
514
-        assert text_file_copy.owner == user2
516
+        assert text_file_copy.parent.content_id == folderb.content_id
517
+        assert text_file_copy.owner.user_id == user.user_id
515
         assert text_file_copy.description == text_file.description
518
         assert text_file_copy.description == text_file.description
516
         assert text_file_copy.file_extension == text_file.file_extension
519
         assert text_file_copy.file_extension == text_file.file_extension
517
         assert text_file_copy.file_mimetype == text_file.file_mimetype
520
         assert text_file_copy.file_mimetype == text_file.file_mimetype
521
+        assert text_file_copy.revision_type == ActionDescription.COPY
518
 
522
 
519
     def test_unit_copy_file_different_label_same_parent_ok(self):
523
     def test_unit_copy_file_different_label_same_parent_ok(self):
520
         uapi = UserApi(None)
524
         uapi = UserApi(None)
583
         )
587
         )
584
         assert text_file != text_file_copy
588
         assert text_file != text_file_copy
585
         assert text_file_copy.content_id != text_file.content_id
589
         assert text_file_copy.content_id != text_file.content_id
586
-        assert text_file_copy.workspace == workspace
587
-        assert text_file_copy.depot_file != text_file.depot_file
590
+        assert text_file_copy.workspace_id == workspace.workspace_id
591
+        assert text_file_copy.depot_file.file.read() == text_file.depot_file.file.read()
592
+        assert text_file_copy.depot_file.path != text_file.depot_file.path
588
         assert text_file_copy.label == 'test_file_copy'
593
         assert text_file_copy.label == 'test_file_copy'
589
         assert text_file_copy.type == text_file.type
594
         assert text_file_copy.type == text_file.type
590
-        assert text_file_copy.parent == foldera
591
-        assert text_file_copy.owner == user2
595
+        assert text_file_copy.parent.content_id == foldera.content_id
596
+        assert text_file_copy.owner.user_id == user.user_id
592
         assert text_file_copy.description == text_file.description
597
         assert text_file_copy.description == text_file.description
593
         assert text_file_copy.file_extension == text_file.file_extension
598
         assert text_file_copy.file_extension == text_file.file_extension
594
         assert text_file_copy.file_mimetype == text_file.file_mimetype
599
         assert text_file_copy.file_mimetype == text_file.file_mimetype
600
+        assert text_file_copy.revision_type == ActionDescription.COPY
595
 
601
 
596
     def test_mark_read__workspace(self):
602
     def test_mark_read__workspace(self):
597
         uapi = UserApi(None)
603
         uapi = UserApi(None)