aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_submission.py
diff options
context:
space:
mode:
authorBrett Smith <brettcsmith@brettcsmith.org>2012-03-17 17:53:00 -0400
committerBrett Smith <brettcsmith@brettcsmith.org>2012-03-17 17:53:00 -0400
commita0a7f87f625ca29ccddc123eb6540aa15a779eb7 (patch)
tree1b8eae477b57c91627095d5040644c26e1560716 /mediagoblin/tests/test_submission.py
parent416b439fc883a570902edd094b44f310d66e849c (diff)
downloadmediagoblin-a0a7f87f625ca29ccddc123eb6540aa15a779eb7.tar.lz
mediagoblin-a0a7f87f625ca29ccddc123eb6540aa15a779eb7.tar.xz
mediagoblin-a0a7f87f625ca29ccddc123eb6540aa15a779eb7.zip
When media is deleted, delete associated comments too.
The actual code is just a simple for loop; there might be a better implementation but this is a fine start. I also extended test_delete to check this too.
Diffstat (limited to 'mediagoblin/tests/test_submission.py')
-rw-r--r--mediagoblin/tests/test_submission.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py
index 2f11bdfb..1f56779e 100644
--- a/mediagoblin/tests/test_submission.py
+++ b/mediagoblin/tests/test_submission.py
@@ -180,6 +180,18 @@ class TestSubmission:
# Does media entry exist?
assert_true(media)
+ # Add a comment, so we can test for its deletion later.
+ get_comments = lambda: list(
+ request.db.MediaComment.find({'media_entry': media._id}))
+ assert_false(get_comments())
+ response = self.test_app.post(
+ request.urlgen('mediagoblin.user_pages.media_post_comment',
+ user=self.test_user.username,
+ media=media._id),
+ {'comment_content': 'i love this test'})
+ response.follow()
+ assert_true(get_comments())
+
# Do not confirm deletion
# ---------------------------------------------------
response = self.test_app.post(
@@ -219,6 +231,9 @@ class TestSubmission:
request.db.MediaEntry.find(
{'_id': media._id}).count())
+ # How about the comment?
+ assert_false(get_comments())
+
def test_malicious_uploads(self):
# Test non-suppoerted file with non-supported extension
# -----------------------------------------------------