Commit e6f3efca authored by Robert's avatar Robert

Add recommendation test

parent cc00f140
Pipeline #1733 passed with stage
in 11 minutes and 44 seconds
from django.urls import reverse
from django.core import mail
from django.test import TestCase
from django.urls import reverse
from grouprise.core import tests
from grouprise.features.gestalten import tests as gestalten
......@@ -93,6 +94,25 @@ class SubscriberGroup(AuthenticatedSubscriberMixin, TestCase):
r = self.client.get(
self.assertContains(r, 'href="{}"'.format(recommend_url))
def test_recommendation(self):
recommend_url = reverse('recommend-group', args=(,))
recommend_email = ''
recommendation_text = 'test recommendation text'
r = self.client.get(recommend_url)
self.assertEqual(r.status_code, 200)
r =, dict(
recipients='foo @{}, <{}>'.format(self.gestalt.user.username, recommend_email),
self.assertEqual(len(mail.outbox), 2)
for email in mail.outbox:
self.assertEqual(email.body, recommendation_text)
# we expect one recipient per mail, stripping surrounding '<>' characters
recipients = [[0][1:-1] for e in mail.outbox]
self.assertEqual(set(recipients), set([, recommend_email]))
class MemberGroup(AuthenticatedMemberMixin, TestCase):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment