Commit 4a177811 authored by jocelyn's avatar jocelyn

Fix maillists module tests

Probably broken in 2b59d862
parent b1b9d802
......@@ -7,7 +7,7 @@ from django.conf import settings
from django.test import TestCase, override_settings
from coin.members.models import Member
from .models import MaillingList
from .models import MaillingList, MaillingListSubscription
@override_settings()
......@@ -43,25 +43,35 @@ class SubscriptionTestCase(TestCase):
shutil.rmtree(self.tmpdir)
def test_subscription_sync(self):
self.ml.subscribers.add(self.member)
sub1 = MaillingListSubscription.objects.create(
member=self.member,
maillinglist=self.ml,
)
self.assertTrue(exists(self.ml_file))
self.assertEqual(open(self.ml_file).read(), 'toto@example.com')
self.ml.subscribers.add(self.member2)
MaillingListSubscription.objects.create(
member=self.member2,
maillinglist=self.ml,
)
self.assertEqual(
open(self.ml_file).read(),
'toto@example.com\nlolo@example.com',
)
self.ml.subscribers.remove(self.member)
sub1.delete()
self.assertEqual(
open(self.ml_file).read(),
'lolo@example.com',
)
def test_email_change_update_subscriptions(self):
self.ml.subscribers.add(self.member)
MaillingListSubscription.objects.create(
member=self.member,
maillinglist=self.ml,
)
# then, change member email
self.member.email = 'tata@example.com'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment