aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tests')
-rw-r--r--mediagoblin/tests/test_api.py7
-rw-r--r--mediagoblin/tests/test_misc.py2
-rw-r--r--mediagoblin/tests/test_modelmethods.py2
-rw-r--r--mediagoblin/tests/test_moderation.py4
-rw-r--r--mediagoblin/tests/test_notifications.py2
-rw-r--r--mediagoblin/tests/test_reporting.py3
-rw-r--r--mediagoblin/tests/tools.py24
7 files changed, 24 insertions, 20 deletions
diff --git a/mediagoblin/tests/test_api.py b/mediagoblin/tests/test_api.py
index 83003875..b58e112f 100644
--- a/mediagoblin/tests/test_api.py
+++ b/mediagoblin/tests/test_api.py
@@ -190,7 +190,7 @@ class TestAPI(object):
# and self._upload_image.
id = int(data["object"]["id"].split("/")[-2])
media = MediaEntry.query.filter_by(id=id).first()
- media.uploader = self.other_user.id
+ media.actor = self.other_user.id
media.save()
# Now lets try and edit the image as self.user, this should produce a 403 error.
@@ -324,7 +324,7 @@ class TestAPI(object):
comment = media.get_comments()[0]
# Tests that it matches in the database
- assert comment.author == self.user.id
+ assert comment.actor == self.user.id
assert comment.content == content
# Test that the response is what we should be given
@@ -384,7 +384,7 @@ class TestAPI(object):
# change who uploaded the comment as it's easier than changing
comment_id = int(comment_data["object"]["id"].split("/")[-2])
comment = MediaComment.query.filter_by(id=comment_id).first()
- comment.author = self.other_user.id
+ comment.actor = self.other_user.id
comment.save()
# Update the comment as someone else.
@@ -597,4 +597,3 @@ class TestAPI(object):
model = MediaComment.query.filter_by(id=comment_id).first()
assert model.content == activity["object"]["content"]
-
diff --git a/mediagoblin/tests/test_misc.py b/mediagoblin/tests/test_misc.py
index b3e59c09..2bff0057 100644
--- a/mediagoblin/tests/test_misc.py
+++ b/mediagoblin/tests/test_misc.py
@@ -50,7 +50,7 @@ def test_user_deletes_other_comments(test_app):
for m_id in (media_a.id, media_b.id):
cmt = MediaComment()
cmt.media_entry = m_id
- cmt.author = u_id
+ cmt.actor = u_id
cmt.content = u"Some Comment"
Session.add(cmt)
diff --git a/mediagoblin/tests/test_modelmethods.py b/mediagoblin/tests/test_modelmethods.py
index 9e0d017c..4c66e27b 100644
--- a/mediagoblin/tests/test_modelmethods.py
+++ b/mediagoblin/tests/test_modelmethods.py
@@ -56,7 +56,7 @@ class TestMediaEntrySlugs(object):
entry.title = title or u"Some title"
entry.slug = slug
entry.id = this_id
- entry.uploader = uploader or self.chris_user.id
+ entry.actor = uploader or self.chris_user.id
entry.media_type = u'image'
if save:
diff --git a/mediagoblin/tests/test_moderation.py b/mediagoblin/tests/test_moderation.py
index 1b071723..85c130ca 100644
--- a/mediagoblin/tests/test_moderation.py
+++ b/mediagoblin/tests/test_moderation.py
@@ -158,7 +158,7 @@ VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n',
fixture_add_comment(author=self.user.id,
comment=u'Comment will be removed')
test_comment = MediaComment.query.filter(
- MediaComment.author==self.user.id).first()
+ MediaComment.actor==self.user.id).first()
fixture_add_comment_report(comment=test_comment,
reported_user=self.user)
comment_report = CommentReport.query.filter(
@@ -177,7 +177,7 @@ VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n',
UserBan.user_id == self.user.id).first()
assert test_user_ban is not None
test_comment = MediaComment.query.filter(
- MediaComment.author==self.user.id).first()
+ MediaComment.actor==self.user.id).first()
assert test_comment is None
# Then, test what happens when a moderator attempts to punish an admin
diff --git a/mediagoblin/tests/test_notifications.py b/mediagoblin/tests/test_notifications.py
index 385da569..f7e67d80 100644
--- a/mediagoblin/tests/test_notifications.py
+++ b/mediagoblin/tests/test_notifications.py
@@ -112,7 +112,7 @@ class TestNotifications:
assert type(notification) == CommentNotification
assert notification.seen == False
assert notification.user_id == user.id
- assert notification.subject.get_author.id == self.test_user.id
+ assert notification.subject.get_actor.id == self.test_user.id
assert notification.subject.content == u'Test comment #42'
if wants_email == True:
diff --git a/mediagoblin/tests/test_reporting.py b/mediagoblin/tests/test_reporting.py
index 1f4573cf..f036303a 100644
--- a/mediagoblin/tests/test_reporting.py
+++ b/mediagoblin/tests/test_reporting.py
@@ -133,7 +133,7 @@ class TestReportFiling:
fixture_add_comment(author=allie_user.id,
comment=u'Comment will be removed')
test_comment = MediaComment.query.filter(
- MediaComment.author==allie_user.id).first()
+ MediaComment.actor==allie_user.id).first()
fixture_add_comment_report(comment=test_comment,
reported_user=allie_user,
report_content=u'Testing Archived Reports #1',
@@ -165,4 +165,3 @@ class TestReportFiling:
natalie banned user allie indefinitely.
natalie deleted the comment.'''
assert archived_report.discriminator == 'comment_report'
-
diff --git a/mediagoblin/tests/tools.py b/mediagoblin/tests/tools.py
index 6c974c39..ba143acd 100644
--- a/mediagoblin/tests/tools.py
+++ b/mediagoblin/tests/tools.py
@@ -204,12 +204,12 @@ def fixture_add_user(username=u'chris', password=u'toast',
def fixture_comment_subscription(entry, notify=True, send_email=None):
if send_email is None:
- uploader = LocalUser.query.filter_by(id=entry.uploader).first()
- send_email = uploader.wants_comment_notification
+ actor = LocalUser.query.filter_by(id=entry.actor).first()
+ send_email = actor.wants_comment_notification
cs = CommentSubscription(
media_entry_id=entry.id,
- user_id=entry.uploader,
+ user_id=entry.actor,
notify=notify,
send_email=send_email)
@@ -254,7 +254,7 @@ def fixture_media_entry(title=u"Some title", slug=None,
entry = MediaEntry()
entry.title = title
entry.slug = slug
- entry.uploader = uploader
+ entry.actor = uploader
entry.media_type = u'image'
entry.state = state
@@ -278,15 +278,21 @@ def fixture_media_entry(title=u"Some title", slug=None,
return entry
-def fixture_add_collection(name=u"My first Collection", user=None):
+def fixture_add_collection(name=u"My first Collection", user=None,
+ collection_type=Collection.USER_DEFINED_TYPE):
if user is None:
user = fixture_add_user()
- coll = Collection.query.filter_by(creator=user.id, title=name).first()
+ coll = Collection.query.filter_by(
+ actor=user.id,
+ title=name,
+ type=collection_type
+ ).first()
if coll is not None:
return coll
coll = Collection()
- coll.creator = user.id
+ coll.actor = user.id
coll.title = name
+ coll.type = collection_type
coll.generate_slug()
coll.save()
@@ -310,7 +316,7 @@ def fixture_add_comment(author=None, media_entry=None, comment=None):
'Auto-generated test comment by user #{0} on media #{0}'.format(
author, media_entry)
- comment = MediaComment(author=author,
+ comment = MediaComment(actor=author,
media_entry=media_entry,
content=comment)
@@ -373,4 +379,4 @@ def fixture_add_activity(obj, verb="post", target=None, generator=None, actor=No
activity.set_target(target)
activity.save()
- return activity \ No newline at end of file
+ return activity