Procházet zdrojové kódy

add check revisions length + do commit in copy test

Guénaël Muller před 6 roky
rodič
revize
20384a7cb7
1 změnil soubory, kde provedl 15 přidání a 4 odebrání
  1. 15 4
      tracim/tracim/tests/library/test_content_api.py

+ 15 - 4
tracim/tracim/tests/library/test_content_api.py Zobrazit soubor

@@ -419,10 +419,12 @@ class TestContentApi(BaseTest, TestStandard):
419 419
             new_label='test_file_copy'
420 420
         )
421 421
 
422
+        transaction.commit()
422 423
         text_file_copy = api2.get_one_by_label_and_parent(
423 424
             'test_file_copy',
424
-            folderb
425
+            folderb,
425 426
         )
427
+
426 428
         assert text_file != text_file_copy
427 429
         assert text_file_copy.content_id != text_file.content_id
428 430
         assert text_file_copy.workspace_id == workspace2.workspace_id
@@ -436,6 +438,7 @@ class TestContentApi(BaseTest, TestStandard):
436 438
         assert text_file_copy.file_extension == text_file.file_extension
437 439
         assert text_file_copy.file_mimetype == text_file.file_mimetype
438 440
         assert text_file_copy.revision_type == ActionDescription.COPY
441
+        assert len(text_file_copy.revisions) == len(text_file.revisions) + 1
439 442
 
440 443
     def test_unit_copy_file__same_label_different_parent_ok(self):
441 444
         uapi = UserApi(None)
@@ -499,13 +502,17 @@ class TestContentApi(BaseTest, TestStandard):
499 502
             'folder b',
500 503
             True
501 504
         )
502
-
503 505
         api2.copy(
504 506
             item=text_file,
505 507
             new_parent=folderb,
506 508
         )
507 509
 
508
-        text_file_copy = api2.get_one_by_label_and_parent('test_file', folderb)
510
+        transaction.commit()
511
+        text_file_copy = api2.get_one_by_label_and_parent(
512
+            'test_file',
513
+            folderb,
514
+        )
515
+
509 516
         assert text_file != text_file_copy
510 517
         assert text_file_copy.content_id != text_file.content_id
511 518
         assert text_file_copy.workspace_id == workspace2.workspace_id
@@ -519,6 +526,7 @@ class TestContentApi(BaseTest, TestStandard):
519 526
         assert text_file_copy.file_extension == text_file.file_extension
520 527
         assert text_file_copy.file_mimetype == text_file.file_mimetype
521 528
         assert text_file_copy.revision_type == ActionDescription.COPY
529
+        assert len(text_file_copy.revisions) == len(text_file.revisions) + 1
522 530
 
523 531
     def test_unit_copy_file_different_label_same_parent_ok(self):
524 532
         uapi = UserApi(None)
@@ -581,10 +589,12 @@ class TestContentApi(BaseTest, TestStandard):
581 589
             new_label='test_file_copy'
582 590
         )
583 591
 
592
+        transaction.commit()
584 593
         text_file_copy = api2.get_one_by_label_and_parent(
585 594
             'test_file_copy',
586
-            foldera
595
+            foldera,
587 596
         )
597
+
588 598
         assert text_file != text_file_copy
589 599
         assert text_file_copy.content_id != text_file.content_id
590 600
         assert text_file_copy.workspace_id == workspace.workspace_id
@@ -598,6 +608,7 @@ class TestContentApi(BaseTest, TestStandard):
598 608
         assert text_file_copy.file_extension == text_file.file_extension
599 609
         assert text_file_copy.file_mimetype == text_file.file_mimetype
600 610
         assert text_file_copy.revision_type == ActionDescription.COPY
611
+        assert len(text_file_copy.revisions) == len(text_file.revisions) + 1
601 612
 
602 613
     def test_mark_read__workspace(self):
603 614
         uapi = UserApi(None)