aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tests')
-rw-r--r--mediagoblin/tests/test_moderation.py18
-rw-r--r--mediagoblin/tests/test_reporting.py11
2 files changed, 20 insertions, 9 deletions
diff --git a/mediagoblin/tests/test_moderation.py b/mediagoblin/tests/test_moderation.py
index 12bf5153..8de76e44 100644
--- a/mediagoblin/tests/test_moderation.py
+++ b/mediagoblin/tests/test_moderation.py
@@ -120,13 +120,17 @@ class TestModerationViews:
'targeted_user':self.user.id},
url='/mod/reports/{0}/'.format(comment_report.id))
+ self.query_for_users()
+ comment_report = CommentReport.query.filter(
+ CommentReport.reported_user==self.user).first()
assert response.status == '302 FOUND'
+ assert not self.user.has_privilege(u'commenter')
+ assert comment_report.is_archived_report() is True
+
fixture_add_comment_report(reported_user=self.user)
comment_report = CommentReport.query.filter(
CommentReport.reported_user==self.user).first()
- assert not self.user.has_privilege(u'commenter')
-
# Then, test a moderator sending an email to a user in response to a
# reported comment
#----------------------------------------------------------------------
@@ -137,6 +141,9 @@ class TestModerationViews:
'targeted_user':self.user.id},
url='/mod/reports/{0}/'.format(comment_report.id))
+ self.query_for_users()
+ comment_report = CommentReport.query.filter(
+ CommentReport.reported_user==self.user).first()
assert response.status == '302 FOUND'
assert mail.EMAIL_TEST_MBOX_INBOX == [{'to': [u'regular@example.com'],
'message': 'Content-Type: text/plain; charset="utf-8"\n\
@@ -144,6 +151,7 @@ MIME-Version: 1.0\nContent-Transfer-Encoding: base64\nSubject: Warning from- \
moderator \nFrom: notice@mediagoblin.example.org\nTo: regular@example.com\n\n\
VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n',
'from': 'notice@mediagoblin.example.org'}]
+ assert comment_report.is_archived_report() is True
# Then test a moderator banning a user AND a moderator deleting the
# offending comment. This also serves as a test for taking multiple
@@ -157,7 +165,8 @@ VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n',
fixture_add_comment_report(comment=test_comment,
reported_user=self.user)
comment_report = CommentReport.query.filter(
- CommentReport.reported_user==self.user).first()
+ CommentReport.comment==test_comment).filter(
+ CommentReport.resolved==None).first()
response, context = self.do_post(
{'action_to_resolve':[u'userban', u'delete'],
@@ -179,7 +188,8 @@ VGhpcyBpcyB5b3VyIGxhc3Qgd2FybmluZywgcmVndWxhci4uLi4=\n',
#----------------------------------------------------------------------
fixture_add_comment_report(reported_user=self.admin_user)
comment_report = CommentReport.query.filter(
- CommentReport.reported_user==self.admin_user).first()
+ CommentReport.reported_user==self.admin_user).filter(
+ CommentReport.resolved==None).first()
response, context = self.do_post({'action_to_resolve':[u'takeaway'],
'take_away_privileges':[u'active'],
diff --git a/mediagoblin/tests/test_reporting.py b/mediagoblin/tests/test_reporting.py
index 1bc7df26..b414a580 100644
--- a/mediagoblin/tests/test_reporting.py
+++ b/mediagoblin/tests/test_reporting.py
@@ -20,7 +20,7 @@ from mediagoblin.tools import template
from mediagoblin.tests.tools import (fixture_add_user, fixture_media_entry,
fixture_add_comment, fixture_add_comment_report)
from mediagoblin.db.models import (MediaReport, CommentReport, User,
- MediaComment,ArchivedReport)
+ MediaComment)
class TestReportFiling:
@@ -148,11 +148,12 @@ class TestReportFiling:
url='/mod/reports/{0}/'.format(comment_report.id))
assert response.status == "302 FOUND"
- self.query_for_users()
+ allie_user, natalie_user = self.query_for_users()
- archived_report = ArchivedReport.query.first()
+ archived_report = CommentReport.query.filter(
+ CommentReport.reported_user==allie_user).first()
- assert CommentReport.query.count() == 0
+ assert CommentReport.query.count() != 0
assert archived_report is not None
assert archived_report.report_content == u'Testing Archived Reports #1'
assert archived_report.reporter_id == natalie_id
@@ -161,5 +162,5 @@ class TestReportFiling:
assert archived_report.resolved is not None
assert archived_report.result == u'This is a test of archiving reports\
.<br>natalie banned user allie indefinitely.<br>natalie deleted the comment.'
- assert archived_report.discriminator == 'archived_report'
+ assert archived_report.discriminator == 'comment_report'