Selaa lähdekoodia

Fix tests for simple copy

Guénaël Muller 6 vuotta sitten
vanhempi
commit
6891f63f76
1 muutettua tiedostoa jossa 18 lisäystä ja 12 poistoa
  1. 18 12
      tracim/tracim/tests/library/test_content_api.py

+ 18 - 12
tracim/tracim/tests/library/test_content_api.py Näytä tiedosto

@@ -425,15 +425,17 @@ class TestContentApi(BaseTest, TestStandard):
425 425
         )
426 426
         assert text_file != text_file_copy
427 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 431
         assert text_file_copy.label == 'test_file_copy'
431 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 435
         assert text_file_copy.description == text_file.description
435 436
         assert text_file_copy.file_extension == text_file.file_extension
436 437
         assert text_file_copy.file_mimetype == text_file.file_mimetype
438
+        assert text_file_copy.revision_type == ActionDescription.COPY
437 439
 
438 440
     def test_unit_copy_file__same_label_different_parent_ok(self):
439 441
         uapi = UserApi(None)
@@ -506,15 +508,17 @@ class TestContentApi(BaseTest, TestStandard):
506 508
         text_file_copy = api2.get_one_by_label_and_parent('test_file', folderb)
507 509
         assert text_file != text_file_copy
508 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 514
         assert text_file_copy.label == text_file.label
512 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 518
         assert text_file_copy.description == text_file.description
516 519
         assert text_file_copy.file_extension == text_file.file_extension
517 520
         assert text_file_copy.file_mimetype == text_file.file_mimetype
521
+        assert text_file_copy.revision_type == ActionDescription.COPY
518 522
 
519 523
     def test_unit_copy_file_different_label_same_parent_ok(self):
520 524
         uapi = UserApi(None)
@@ -583,15 +587,17 @@ class TestContentApi(BaseTest, TestStandard):
583 587
         )
584 588
         assert text_file != text_file_copy
585 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 593
         assert text_file_copy.label == 'test_file_copy'
589 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 597
         assert text_file_copy.description == text_file.description
593 598
         assert text_file_copy.file_extension == text_file.file_extension
594 599
         assert text_file_copy.file_mimetype == text_file.file_mimetype
600
+        assert text_file_copy.revision_type == ActionDescription.COPY
595 601
 
596 602
     def test_mark_read__workspace(self):
597 603
         uapi = UserApi(None)