aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_notifications.py
diff options
context:
space:
mode:
authortilly-Q <nattilypigeonfowl@gmail.com>2013-09-12 18:58:04 -0400
committertilly-Q <nattilypigeonfowl@gmail.com>2013-09-12 18:58:04 -0400
commit045fe0ee9d43aa825de6fbf14fe8fd48953d4eff (patch)
treee0743c13e20845a613ba8e4064cb1e0f10f54025 /mediagoblin/tests/test_notifications.py
parenta02831687a6026b2baa0f971ecb3e594c3f415e2 (diff)
parent66cafc3b74d476710013efb46341b989028f3057 (diff)
downloadmediagoblin-045fe0ee9d43aa825de6fbf14fe8fd48953d4eff.tar.lz
mediagoblin-045fe0ee9d43aa825de6fbf14fe8fd48953d4eff.tar.xz
mediagoblin-045fe0ee9d43aa825de6fbf14fe8fd48953d4eff.zip
Merge branch 'master' into OPW-Moderation-Update
Conflicts: mediagoblin/db/migrations.py
Diffstat (limited to 'mediagoblin/tests/test_notifications.py')
-rw-r--r--mediagoblin/tests/test_notifications.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/mediagoblin/tests/test_notifications.py b/mediagoblin/tests/test_notifications.py
index 2b414590..0908cb34 100644
--- a/mediagoblin/tests/test_notifications.py
+++ b/mediagoblin/tests/test_notifications.py
@@ -153,3 +153,56 @@ otherperson@example.com\n\nSGkgb3RoZXJwZXJzb24sCmNocmlzIGNvbW1lbnRlZCBvbiB5b3VyI
# User should not have been notified
assert len(notifications) == 1
+
+ def test_mark_all_comment_notifications_seen(self):
+ """ Test that mark_all_comments_seen works"""
+
+ user = fixture_add_user('otherperson', password='nosreprehto')
+
+ media_entry = fixture_media_entry(uploader=user.id, state=u'processed')
+
+ fixture_comment_subscription(media_entry)
+
+ media_uri_id = '/u/{0}/m/{1}/'.format(user.username,
+ media_entry.id)
+
+ # add 2 comments
+ self.test_app.post(
+ media_uri_id + 'comment/add/',
+ {
+ 'comment_content': u'Test comment #43'
+ }
+ )
+
+ self.test_app.post(
+ media_uri_id + 'comment/add/',
+ {
+ 'comment_content': u'Test comment #44'
+ }
+ )
+
+ notifications = Notification.query.filter_by(
+ user_id=user.id).all()
+
+ assert len(notifications) == 2
+
+ # both comments should not be marked seen
+ assert notifications[0].seen == False
+ assert notifications[1].seen == False
+
+ # login with other user to mark notifications seen
+ self.logout()
+ self.login('otherperson', 'nosreprehto')
+
+ # mark all comment notifications seen
+ res = self.test_app.get('/notifications/comments/mark_all_seen/')
+ res.follow()
+
+ assert urlparse.urlsplit(res.location)[2] == '/'
+
+ notifications = Notification.query.filter_by(
+ user_id=user.id).all()
+
+ # both notifications should be marked seen
+ assert notifications[0].seen == True
+ assert notifications[1].seen == True