Ejemplo n.º 1
0
 def test_name_affirmation_not_installed(self, mock_manager):
     mock_manager.side_effect = PluginError('No such plugin')
     with self.assertRaises(PluginError):
         self.assertFalse(is_name_affirmation_installed())
Ejemplo n.º 2
0
from lms.djangoapps.certificates.data import CertificateStatuses

from openedx.core.djangoapps.enrollments.api import get_verified_enrollments
from openedx.core.djangoapps.user_api import accounts, errors, helpers
from openedx.core.djangoapps.user_api.errors import (AccountUpdateError,
                                                     AccountValidationError,
                                                     PreferenceValidationError)
from openedx.core.djangoapps.user_api.preferences.api import update_user_preferences
from openedx.core.djangoapps.user_authn.utils import check_pwned_password
from openedx.core.djangoapps.user_authn.views.registration_form import validate_name, validate_username
from openedx.core.lib.api.view_utils import add_serializer_errors
from openedx.features.enterprise_support.utils import get_enterprise_readonly_account_fields
from openedx.features.name_affirmation_api.utils import is_name_affirmation_installed
from .serializers import AccountLegacyProfileSerializer, AccountUserSerializer, UserReadOnlySerializer, _visible_fields

name_affirmation_installed = is_name_affirmation_installed()
if name_affirmation_installed:
    # pylint: disable=import-error
    from edx_name_affirmation.name_change_validator import NameChangeValidator

# Public access point for this function.
visible_fields = _visible_fields


@helpers.intercept_errors(errors.UserAPIInternalError,
                          ignore_errors=[errors.UserAPIRequestError])
def get_account_settings(request,
                         usernames=None,
                         configuration=None,
                         view=None):
    """Returns account information for a user serialized as JSON.
Ejemplo n.º 3
0
 def test_name_affirmation_installed(self, mock_manager):
     mock_manager.get_plugin.return_value = 'mock plugin'
     self.assertTrue(is_name_affirmation_installed())