'Test what happens if all validation checks pass, but sending the email for email change fails.'

@patch('django.core.mail.send_mail')
@patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True))
def test_update_sending_email_fails(self, send_mail):

    send_mail.side_effect = [Exception, None]
    less_naughty_update = {'name': 'Mickey    Mouse', 'email': 'seems_ok@sample.com'}
    with self.assertRaises(AccountUpdateError) as context_manager:
        update_account_settings(self.user, less_naughty_update)
    self.assertIn('Error    thrown    from    do_email_change_request', context_manager.exception.developer_message)
    account_settings = get_account_settings(self.default_request)[0]
    self.assertEqual('Mickey    Mouse', account_settings['name'])
