aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_misc.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2016-02-29 14:35:30 +0000
committerJessica Tallon <tsyesika@tsyesika.se>2016-02-29 15:40:34 +0000
commit2104c3e0f267101da35aa9d507ae6dd3a9b0c5b6 (patch)
tree3528a22e0501cbaab280404cf69929eb145a98c7 /mediagoblin/tests/test_misc.py
parent7fa67404eec307caaf682ac52e39af07425028c4 (diff)
downloadmediagoblin-2104c3e0f267101da35aa9d507ae6dd3a9b0c5b6.tar.lz
mediagoblin-2104c3e0f267101da35aa9d507ae6dd3a9b0c5b6.tar.xz
mediagoblin-2104c3e0f267101da35aa9d507ae6dd3a9b0c5b6.zip
Fix #5415 - Deleted comments get removed properly when tombstones
The original wrapper existed and should be been removed, this fix now ensures the TextComment removes the Comment wrapper to prevent the deleted (comments which are tombstones) existing.
Diffstat (limited to 'mediagoblin/tests/test_misc.py')
-rw-r--r--mediagoblin/tests/test_misc.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_misc.py b/mediagoblin/tests/test_misc.py
index 558a9bd7..34235209 100644
--- a/mediagoblin/tests/test_misc.py
+++ b/mediagoblin/tests/test_misc.py
@@ -138,3 +138,34 @@ def test_garbage_collection_task(test_app):
# Now validate the image has been deleted
assert MediaEntry.query.filter_by(id=entry_id).first() is None
+
+def test_comments_removed_when_graveyarded(test_app):
+ """ Checks comments which are tombstones are removed from collection """
+ user = fixture_add_user()
+ media = fixture_media_entry(
+ uploader=user.id,
+ expunge=False,
+ fake_upload=False
+ )
+
+ # Add the TextComment
+ comment = TextComment()
+ comment.actor = user.id
+ comment.content = u"This is a comment that will be deleted."
+ comment.save()
+
+ # Add a link for the comment
+ link = Comment()
+ link.target = media
+ link.comment = comment
+ link.save()
+
+ # First double check it's there and all is well...
+ assert Comment.query.filter_by(target_id=link.target_id).first() is not None
+
+ # Now delete the comment.
+ comment.delete()
+
+ # Verify this also deleted the Comment link, ergo there is no comment left.
+ assert Comment.query.filter_by(target_id=link.target_id).first() is None
+