Ejemplo n.º 1
0
 def test_member_removed(self):
     template_name = 'groups/email/member_removed.txt'
     template = get_template(template_name)
     with patch('mozillians.groups.tasks.get_template', autospec=True) as mock_get_template:
         mock_get_template.return_value = template
         with patch('mozillians.groups.tasks.send_mail', autospec=True) as mock_send_mail:
             email_membership_change(self.group.pk, self.user.pk, GroupMembership.MEMBER, None)
     ok_(mock_send_mail.called)
     ok_(mock_get_template.called)
     eq_(template_name, mock_get_template.call_args[0][0])
     subject, body, from_addr, to_list = mock_send_mail.call_args[0]
     eq_(settings.FROM_NOREPLY, from_addr)
     eq_([self.user.email], to_list)
     eq_('Removed from Mozillians group "%s"' % self.group.name, subject)
     ok_('You have been removed' in body)
Ejemplo n.º 2
0
 def test_member_rejected(self):
     template_name = 'groups/email/rejected.txt'
     template = get_template(template_name)
     with patch('mozillians.groups.tasks.get_template', autospec=True) as mock_get_template:
         mock_get_template.return_value = template
         with patch('mozillians.groups.tasks.send_mail', autospec=True) as mock_send_mail:
             email_membership_change(self.group.pk, self.user.pk,
                                     GroupMembership.PENDING, None)
     ok_(mock_send_mail.called)
     ok_(mock_get_template.called)
     eq_(template_name, mock_get_template.call_args[0][0])
     subject, body, from_addr, to_list = mock_send_mail.call_args[0]
     eq_(settings.FROM_NOREPLY, from_addr)
     eq_([self.user.email], to_list)
     eq_('Not accepted to Mozillians group "%s"' % self.group.name, subject)
     ok_('You have not been accepted' in body)
Ejemplo n.º 3
0
 def test_membership_changed(self):
     template_name = 'groups/email/membership_status_changed.txt'
     template = get_template(template_name)
     with patch('mozillians.groups.tasks.get_template',
                autospec=True) as mock_get_template:
         mock_get_template.return_value = template
         with patch('mozillians.groups.tasks.send_mail',
                    autospec=True) as mock_send_mail:
             email_membership_change(self.group.pk, self.user.pk,
                                     GroupMembership.MEMBER,
                                     GroupMembership.PENDING)
     ok_(mock_send_mail.called)
     ok_(mock_get_template.called)
     eq_(template_name, mock_get_template.call_args[0][0])
     subject, body, from_addr, to_list = mock_send_mail.call_args[0]
     eq_(settings.FROM_NOREPLY, from_addr)
     eq_([self.user.email], to_list)
     eq_('Status changed for Mozillians group "%s"' % self.group.name,
         subject)
     ok_('Your membership status has changed' in body)