src/cm/tests/test_structure.py
changeset 278 3d25afbd78ff
parent 103 61fd17f9ab78
equal deleted inserted replaced
277:588ca38ccb61 278:3d25afbd78ff
    23         self.assertEqual(Comment.objects.count(), 16)
    23         self.assertEqual(Comment.objects.count(), 16)
    24         
    24         
    25         # edit with duplication changing content
    25         # edit with duplication changing content
    26         new_text = text.edit(new_title='my title', 
    26         new_text = text.edit(new_title='my title', 
    27                   new_format='html', 
    27                   new_format='html', 
    28                   new_content='simple text <p>simple text</p> <p>simple text</p> ', 
    28                   new_content=u'simple text <p>simple text</p> <p>simple text</p> ', 
    29                   keep_comments = True, 
    29                   keep_comments = True, 
    30                   cancel_modified_scopes=False,                  
    30                   cancel_modified_scopes=False,                  
    31                   new_version = True)
    31                   new_version = True)
    32         self.assertEqual(TextVersion.objects.count(), 3)
    32         self.assertEqual(TextVersion.objects.count(), 3)
    33         self.assertEqual(Comment.objects.count(), 17) # 22
    33         self.assertEqual(Comment.objects.count(), 17) # 22
    34 
    34 
    35         # edit without duplication, completely changing content
    35         # edit without duplication, completely changing content
    36         new_text = text.edit(new_title='my title', 
    36         new_text = text.edit(new_title='my title', 
    37                   new_format='html', 
    37                   new_format='html', 
    38                   new_content='xxxxxx', 
    38                   new_content=u'xxxxxx', 
    39                   keep_comments = True, 
    39                   keep_comments = True, 
    40                   cancel_modified_scopes=False,                  
    40                   cancel_modified_scopes=False,                  
    41                   new_version = False)
    41                   new_version = False)
    42         self.assertEqual(TextVersion.objects.count(), 3)
    42         self.assertEqual(TextVersion.objects.count(), 3)
    43         self.assertEqual(Comment.objects.count(), 16) # 21
    43         self.assertEqual(Comment.objects.count(), 16) # 21
    46         self.assertEqual(TextVersion.objects.count(), 1)
    46         self.assertEqual(TextVersion.objects.count(), 1)
    47         self.assertEqual(Comment.objects.count(), 8)
    47         self.assertEqual(Comment.objects.count(), 8)
    48         text = Text.objects.all()[0]
    48         text = Text.objects.all()[0]
    49         new_text = text.edit(new_title='my title', 
    49         new_text = text.edit(new_title='my title', 
    50                   new_format='html', 
    50                   new_format='html', 
    51                   new_content='xxxxxx', 
    51                   new_content=u'xxxxxx', 
    52                   keep_comments = False, 
    52                   keep_comments = False, 
    53                   cancel_modified_scopes=False,                  
    53                   cancel_modified_scopes=False,                  
    54                   new_version = False)
    54                   new_version = False)
    55         self.assertEqual(TextVersion.objects.count(), 1)
    55         self.assertEqual(TextVersion.objects.count(), 1)
    56         self.assertEqual(Comment.objects.count(), 0)
    56         self.assertEqual(Comment.objects.count(), 0)
    59         self.assertEqual(TextVersion.objects.count(), 1)
    59         self.assertEqual(TextVersion.objects.count(), 1)
    60         self.assertEqual(Comment.objects.count(), 8)
    60         self.assertEqual(Comment.objects.count(), 8)
    61         text = Text.objects.all()[0]
    61         text = Text.objects.all()[0]
    62         new_text = text.edit(new_title='my title', 
    62         new_text = text.edit(new_title='my title', 
    63                   new_format='html', 
    63                   new_format='html', 
    64                   new_content='xxxxxx', 
    64                   new_content=u'xxxxxx', 
    65                   keep_comments = False, 
    65                   keep_comments = False, 
    66                   cancel_modified_scopes=False,                  
    66                   cancel_modified_scopes=False,                  
    67                   new_version = True)
    67                   new_version = True)
    68         self.assertEqual(TextVersion.objects.count(), 2)
    68         self.assertEqual(TextVersion.objects.count(), 2)
    69         self.assertEqual(Comment.objects.count(), 8)
    69         self.assertEqual(Comment.objects.count(), 8)