club: fix mailing list form that unexpectedly relied on try catch in permissions

This commit is contained in:
Antoine Bartuccio 2019-10-16 21:21:06 +02:00
parent fe9164bfef
commit 811809895e
Signed by: klmp200
GPG Key ID: E7245548C53F904B
2 changed files with 8 additions and 2 deletions

View File

@ -641,7 +641,7 @@ class MailingFormTest(TestCase):
{"action": MailingForm.ACTION_NEW_MAILING, "mailing_email": "mde"},
)
mde = Mailing.objects.get(email="mde")
response = self.client.post(
self.client.post(
reverse("club:mailing", kwargs={"club_id": self.bdf.id}),
{
"action": MailingForm.ACTION_NEW_SUBSCRIPTION,
@ -650,6 +650,11 @@ class MailingFormTest(TestCase):
"subscription_mailing": mde.id,
},
)
response = self.client.get(
reverse("club:mailing", kwargs={"club_id": self.bdf.id})
)
self.assertContains(response, "comunity@git.an")
self.assertContains(response, "richard@git.an")
self.assertContains(response, "krophil@git.an")

View File

@ -574,7 +574,8 @@ class ClubMailingView(ClubTabsMixin, CanEditMixin, DetailFormView):
except ValidationError as validation_error:
return validation_error
users_to_save.append(sub.save())
sub.save()
users_to_save.append(sub)
if cleaned_data["subscription_email"]:
sub = MailingSubscription(