'Test the behavior of one of the serializers failing to save. Note that email request change
won\'t be processed in this case.'

@patch('openedx.core.djangoapps.user_api.accounts.serializers.AccountUserSerializer.save')
def test_serializer_save_fails(self, serializer_save):

    serializer_save.side_effect = [Exception, None]
    update_will_fail = {'name': 'Mickey    Mouse', 'email': 'ok@sample.com'}
    with self.assertRaises(AccountUpdateError) as context_manager:
        update_account_settings(self.user, update_will_fail)
    self.assertIn('Error    thrown    when    saving    account    updates', context_manager.exception.developer_message)
    pending_change = PendingEmailChange.objects.filter(user=self.user)
    self.assertEqual(0, len(pending_change))
