diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-06-08 20:43:20 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-06-08 20:43:20 -0400 |
commit | 2f76b6460e0da66a2ef4251301059c84b3f5a753 (patch) | |
tree | dfb05ee36851786b499223f0d56c244f5525e69c /forum/tests.py | |
parent | e215c1d15b049b04f7a2497c07d3c9a3f380638d (diff) | |
download | askbot-2f76b6460e0da66a2ef4251301059c84b3f5a753.tar.gz askbot-2f76b6460e0da66a2ef4251301059c84b3f5a753.tar.bz2 askbot-2f76b6460e0da66a2ef4251301059c84b3f5a753.zip |
envelope turns on correctly when there are new content or mention responses
Diffstat (limited to 'forum/tests.py')
-rw-r--r-- | forum/tests.py | 116 |
1 files changed, 115 insertions, 1 deletions
diff --git a/forum/tests.py b/forum/tests.py index d93e7d4e..28544b73 100644 --- a/forum/tests.py +++ b/forum/tests.py @@ -135,7 +135,7 @@ class UpdateNotificationTests(TestCase): timestamp = datetime.datetime.now() self.question.add_comment( user = self.u11, - comment = 'self-comment 1', + comment = 'self-comment', added_at = timestamp ) notifications = get_re_notif_after(timestamp) @@ -203,6 +203,120 @@ class UpdateNotificationTests(TestCase): ] ) + def test_self_mention_not_posting_in_comment_to_question1(self): + self.reset_response_counts() + time.sleep(1) + timestamp = datetime.datetime.now() + self.question.add_comment( + user = self.u11, + comment = 'self-comment @user11', + added_at = timestamp + ) + notifications = get_re_notif_after(timestamp) + self.assertEqual(len(notifications), 1) + self.assertEqual( + set(notifications[0].receiving_users.all()), + set([self.u12, self.u13]), + ) + self.reload_users() + self.assertEqual( + [ + self.u11.response_count, + self.u12.response_count, + self.u13.response_count, + self.u14.response_count, + self.u21.response_count, + self.u22.response_count, + self.u23.response_count, + self.u24.response_count, + self.u31.response_count, + self.u32.response_count, + self.u33.response_count, + self.u34.response_count, + ], + [ + 0, 1, 1, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + ] + ) + + def test_self_mention_not_posting_in_comment_to_question2(self): + self.reset_response_counts() + time.sleep(1) + timestamp = datetime.datetime.now() + self.question.add_comment( + user = self.u11, + comment = 'self-comment @user11 blah', + added_at = timestamp + ) + notifications = get_re_notif_after(timestamp) + self.assertEqual(len(notifications), 1) + self.assertEqual( + set(notifications[0].receiving_users.all()), + set([self.u12, self.u13]), + ) + self.reload_users() + self.assertEqual( + [ + self.u11.response_count, + self.u12.response_count, + self.u13.response_count, + self.u14.response_count, + self.u21.response_count, + self.u22.response_count, + self.u23.response_count, + self.u24.response_count, + self.u31.response_count, + self.u32.response_count, + self.u33.response_count, + self.u34.response_count, + ], + [ + 0, 1, 1, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + ] + ) + + def test_self_mention_not_posting_in_comment_to_answer(self): + self.reset_response_counts() + time.sleep(1) + timestamp = datetime.datetime.now() + self.answer1.add_comment( + user = self.u21, + comment = 'self-comment 1 @user21', + added_at = timestamp + ) + notifications = get_re_notif_after(timestamp) + self.assertEqual(len(notifications), 1) + self.assertEqual( + set(notifications[0].receiving_users.all()), + set([self.u22, self.u23]), + ) + self.reload_users() + self.assertEqual( + [ + self.u11.response_count, + self.u12.response_count, + self.u13.response_count, + self.u14.response_count, + self.u21.response_count, + self.u22.response_count, + self.u23.response_count, + self.u24.response_count, + self.u31.response_count, + self.u32.response_count, + self.u33.response_count, + self.u34.response_count, + ], + [ + 0, 0, 0, 0, + 0, 1, 1, 0, + 0, 0, 0, 0, + ] + ) + def test_comments_to_post_authors(self): self.question.apply_edit( edited_by = self.u14, |