Ejemplo n.º 1
0
    def test_invite_content(self):
        """Verify the email content is correct."""
        invite = mommy.make('accounts.Invite')
        self.assertFalse(invite.notified)

        with patch('open_connect.accounts.tasks.send_email') as mock:
            render_and_send_invite_email(invite.pk)

        call_args = mock.call_args[1]
        self.assertEqual(call_args['email'], invite.email)
        self.assertEqual(call_args['from_email'], settings.DEFAULT_FROM_EMAIL)
        # Confirm that the unsubscribe URL is in the message
        self.assertIn(unsubscribe_url(invite.email), call_args['text'])
        self.assertIn(unsubscribe_url(invite.email), call_args['html'])

        invite = Invite.objects.get(pk=invite.pk)
        self.assertIsInstance(invite.notified, datetime)
Ejemplo n.º 2
0
    def test_invite_content(self):
        """Verify the email content is correct."""
        invite = mommy.make("accounts.Invite")
        self.assertFalse(invite.notified)

        with patch("open_connect.accounts.tasks.send_email") as mock:
            render_and_send_invite_email(invite.pk)

        call_args = mock.call_args[1]
        self.assertEqual(call_args["email"], invite.email)
        self.assertEqual(call_args["from_email"], settings.DEFAULT_FROM_EMAIL)
        # Confirm that the unsubscribe URL is in the message
        self.assertIn(unsubscribe_url(invite.email), call_args["text"])
        self.assertIn(unsubscribe_url(invite.email), call_args["html"])

        invite = Invite.objects.get(pk=invite.pk)
        self.assertIsInstance(invite.notified, datetime)
Ejemplo n.º 3
0
    def test_unsubscribe_url(self):
        """Test that all the required components are in the URL"""
        result = utils.unsubscribe_url('*****@*****.**')
        unsub_url = reverse('unsubscribe')
        code = generate_nologin_hash('*****@*****.**')

        self.assertIn(unsub_url, result)
        self.assertIn('code=%s' % code, result)
        self.assertIn('[email protected]', result)
        self.assertIn('http://connect.local', result)
Ejemplo n.º 4
0
    def test_unsubscribe_url(self):
        """Test that all the required components are in the URL"""
        result = utils.unsubscribe_url('*****@*****.**')
        unsub_url = reverse('unsubscribe')
        code = generate_nologin_hash('*****@*****.**')

        self.assertIn(unsub_url, result)
        self.assertIn('code=%s' % code, result)
        self.assertIn('[email protected]', result)
        self.assertIn('http://connect.local', result)
Ejemplo n.º 5
0
 def unsubscribe_url(self):
     """URL the user visits to unsubscribe from all emails"""
     return unsubscribe_url(self.email)
Ejemplo n.º 6
0
def unsubscribe_link(email):
    """Tag which returns the URL to unsubscribe for an email"""
    return unsubscribe_url(email)
Ejemplo n.º 7
0
 def unsubscribe_url(self):
     """URL the user visits to unsubscribe from all emails"""
     return unsubscribe_url(self.email)
Ejemplo n.º 8
0
def unsubscribe_link(email):
    """Tag which returns the URL to unsubscribe for an email"""
    return unsubscribe_url(email)