'Test that update_user is called with new language preference'

@patch('lms.djangoapps.email_marketing.tasks.update_user.delay')
def test_modify_language_preference(self, mock_update_user):

    self.assertIsNone(self.user.preferences.model.get_value(self.user, LANGUAGE_KEY))
    email_marketing_user_field_changed(None, self.user, table='user_api_userpreference', setting=LANGUAGE_KEY, new_value=None)
    self.assertEqual(mock_update_user.call_args[0][0]['ui_lang'], settings.LANGUAGE_CODE)
    self.user.preferences.create(key=LANGUAGE_KEY, value='fr')
    email_marketing_user_field_changed(None, self.user, table='user_api_userpreference', setting=LANGUAGE_KEY, new_value='fr')
    self.assertEqual(mock_update_user.call_args[0][0]['ui_lang'], 'fr')
