aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_misc.py
diff options
context:
space:
mode:
authorJessica Tallon <tsyesika@tsyesika.se>2015-10-20 12:24:54 +0000
committerJessica Tallon <tsyesika@tsyesika.se>2015-10-20 12:24:54 +0000
commit64a456a4e50b03e4fa2b33ceb208e88d2e02fce7 (patch)
treef60658eb937886dfd1cc349cab605c13a02942e5 /mediagoblin/tests/test_misc.py
parentfd703bb4d0665958d853b89f6069eefd8a8c8113 (diff)
downloadmediagoblin-64a456a4e50b03e4fa2b33ceb208e88d2e02fce7.tar.lz
mediagoblin-64a456a4e50b03e4fa2b33ceb208e88d2e02fce7.tar.xz
mediagoblin-64a456a4e50b03e4fa2b33ceb208e88d2e02fce7.zip
Comment changes for federation
This adds a new Comment link table that is used to link between some object and then the comment object, which can be more or less any object in Mediagoblin. The MediaComment has been renamed to TextComment as that more aptly describes what it is. There is migrations for these changes. There is also the conslidation of the Report tables into a single Report table, the same with the Notification objects. This is because both of them split out MediaEntry and Comment versions into their own polymorphic versions from a base, this is no longer a meaningful distinction as comments can be anything.
Diffstat (limited to 'mediagoblin/tests/test_misc.py')
-rw-r--r--mediagoblin/tests/test_misc.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/mediagoblin/tests/test_misc.py b/mediagoblin/tests/test_misc.py
index 2bff0057..558a9bd7 100644
--- a/mediagoblin/tests/test_misc.py
+++ b/mediagoblin/tests/test_misc.py
@@ -24,7 +24,7 @@ from mediagoblin.db.base import Session
from mediagoblin.media_types import sniff_media
from mediagoblin.submit.lib import new_upload_entry
from mediagoblin.submit.task import collect_garbage
-from mediagoblin.db.models import User, MediaEntry, MediaComment
+from mediagoblin.db.models import User, MediaEntry, TextComment, Comment
from mediagoblin.tests.tools import fixture_add_user, fixture_media_entry
@@ -46,25 +46,31 @@ def test_user_deletes_other_comments(test_app):
Session.flush()
# Create all 4 possible comments:
- for u_id in (user_a.id, user_b.id):
- for m_id in (media_a.id, media_b.id):
- cmt = MediaComment()
- cmt.media_entry = m_id
- cmt.actor = u_id
+ for u in (user_a, user_b):
+ for m in (media_a, media_b):
+ cmt = TextComment()
+ cmt.actor = u.id
cmt.content = u"Some Comment"
Session.add(cmt)
+ # think i need this to get the command ID
+ Session.flush()
+
+ link = Comment()
+ link.target = m
+ link.comment = cmt
+ Session.add(link)
Session.flush()
usr_cnt1 = User.query.count()
med_cnt1 = MediaEntry.query.count()
- cmt_cnt1 = MediaComment.query.count()
+ cmt_cnt1 = TextComment.query.count()
User.query.get(user_a.id).delete(commit=False)
usr_cnt2 = User.query.count()
med_cnt2 = MediaEntry.query.count()
- cmt_cnt2 = MediaComment.query.count()
+ cmt_cnt2 = TextComment.query.count()
# One user deleted
assert usr_cnt2 == usr_cnt1 - 1
@@ -77,7 +83,7 @@ def test_user_deletes_other_comments(test_app):
usr_cnt2 = User.query.count()
med_cnt2 = MediaEntry.query.count()
- cmt_cnt2 = MediaComment.query.count()
+ cmt_cnt2 = TextComment.query.count()
# All users gone
assert usr_cnt2 == usr_cnt1 - 2