summaryrefslogtreecommitdiffstats
path: root/hyperkitty/tests/test_lib.py
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-11-29 12:13:23 +0100
committerAurélien Bompard <aurelien@bompard.org>2013-11-29 12:13:23 +0100
commit5bca903d1c75a59a3e415d14812b4ffca769d930 (patch)
tree289ecf0c5a6fa6d68be0d65399dee7e8d650260f /hyperkitty/tests/test_lib.py
parent7cbafa8b495c2a79339df6e68adb6023eb1d83eb (diff)
downloadhyperkitty-5bca903d1c75a59a3e415d14812b4ffca769d930.tar.gz
hyperkitty-5bca903d1c75a59a3e415d14812b4ffca769d930.tar.xz
hyperkitty-5bca903d1c75a59a3e415d14812b4ffca769d930.zip
Fix bug in voting when emails in different lists have the same msgid
Diffstat (limited to 'hyperkitty/tests/test_lib.py')
-rw-r--r--hyperkitty/tests/test_lib.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/hyperkitty/tests/test_lib.py b/hyperkitty/tests/test_lib.py
index 6b6a9e1..0f31fe1 100644
--- a/hyperkitty/tests/test_lib.py
+++ b/hyperkitty/tests/test_lib.py
@@ -26,7 +26,7 @@ from django.core.cache import cache
from hyperkitty.models import Rating
from hyperkitty.lib.view_helpers import get_display_dates, paginate
-from hyperkitty.lib.voting import get_votes, set_thread_votes
+from hyperkitty.lib.voting import set_thread_votes
from hyperkitty.tests.utils import TestCase
@@ -154,3 +154,20 @@ class VotingTestCase(TestCase):
self.assertEqual(self.thread.likes, 10)
self.assertEqual(self.thread.dislikes, 0)
self.assertEqual(self.thread.likestatus, "likealot")
+
+ def test_same_msgid_different_lists(self):
+ thread_1 = DummyThread()
+ thread_1.list_name = "test1@example.com"
+ thread_2 = DummyThread()
+ thread_2.list_name = "test2@example.com"
+ thread_1.email_id_hashes = thread_2.email_id_hashes = ["msgid"]
+ Rating(list_address="test1@example.com", messageid="msgid",
+ user=self.user, vote=1).save()
+ Rating(list_address="test2@example.com", messageid="msgid",
+ user=self.user, vote=1).save()
+ set_thread_votes(thread_1)
+ self.assertEqual(thread_1.likes, 1)
+ self.assertEqual(thread_1.dislikes, 0)
+ set_thread_votes(thread_2)
+ self.assertEqual(thread_2.likes, 1)
+ self.assertEqual(thread_2.dislikes, 0)