51 if not new: |
51 if not new: |
52 self.assertFalse(Comment.objects.filter(id=id)) |
52 self.assertFalse(Comment.objects.filter(id=id)) |
53 else: |
53 else: |
54 x, y , z, k = new |
54 x, y , z, k = new |
55 self.assert_comment(id, x, y, z, k) |
55 self.assert_comment(id, x, y, z, k) |
|
56 |
|
57 def test_remove_comment(self): |
|
58 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
|
59 new_content = u"""<html><body>This is a <b>te</b>e<b>est</b> text</body></html>""" |
|
60 |
|
61 text = Text.objects.create_text("text", "html", content, "", "", "", None) |
|
62 |
|
63 comment1 = create_comment(2, 2, 2, 4) |
|
64 comment2 = create_comment(2, 2, 2, 4) |
|
65 |
|
66 version = Text.objects.all()[0].get_latest_version() |
|
67 |
|
68 self.assertEqual(len(version.get_comments()), 2) |
|
69 |
|
70 version.edit("text", "html", new_content, keep_comments = False, cancel_modified_scopes=False) |
|
71 |
|
72 self.assertEqual(len(version.get_comments()), 0) |
56 |
73 |
57 def test_wrapper_shifted(self): |
74 def test_wrapper_shifted(self): |
58 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
75 content = u"""<html><body>This is a <b>test</b> text</body></html>""" |
59 new_content = u"""<html><body>This is a <b>te</b>e<b>est</b> text</body></html>""" |
76 new_content = u"""<html><body>This is a <b>te</b>e<b>est</b> text</body></html>""" |
60 self.preserve_comment_pos(content, new_content, [([2,2,2,4],[4,4,2,4]),]) |
77 self.preserve_comment_pos(content, new_content, [([2,2,2,4],[4,4,2,4]),]) |