diff --git a/openedx/core/djangoapps/demographics/models.py b/openedx/core/djangoapps/demographics/models.py index 2ed7980285..09c9251b0e 100644 --- a/openedx/core/djangoapps/demographics/models.py +++ b/openedx/core/djangoapps/demographics/models.py @@ -1,4 +1,7 @@ -# lint-amnesty, pylint: disable=missing-module-docstring +""" +Demographics models +""" + from django.contrib.auth import get_user_model from django.db import models from model_utils.models import TimeStampedModel @@ -11,6 +14,8 @@ class UserDemographics(TimeStampedModel): """ A Users Demographics platform related data in support of the Demographics IDA and features + + .. no_pii: """ user = models.OneToOneField(User, on_delete=models.CASCADE) show_call_to_action = models.BooleanField(default=True) diff --git a/openedx/core/djangoapps/demographics/rest_api/v1/views.py b/openedx/core/djangoapps/demographics/rest_api/v1/views.py index 12489953f1..ab114c41f4 100644 --- a/openedx/core/djangoapps/demographics/rest_api/v1/views.py +++ b/openedx/core/djangoapps/demographics/rest_api/v1/views.py @@ -21,7 +21,10 @@ class DemographicsStatusView(APIView): authentication_classes = (JwtAuthentication, SessionAuthentication) permission_classes = (permissions.IsAuthenticated, ) - def _response_context(self, user, user_demographics=None): # lint-amnesty, pylint: disable=missing-function-docstring + def _response_context(self, user, user_demographics=None): + """ + Determine whether the user should be shown demographics collection fields and the demographics call to action. + """ if user_demographics: show_call_to_action = user_demographics.show_call_to_action else: diff --git a/openedx/core/djangoapps/demographics/tests/test_status.py b/openedx/core/djangoapps/demographics/tests/test_status.py index 10918b61c2..1007534202 100644 --- a/openedx/core/djangoapps/demographics/tests/test_status.py +++ b/openedx/core/djangoapps/demographics/tests/test_status.py @@ -1,25 +1,24 @@ """ Test status utilities """ +from unittest import TestCase from unittest import mock from django.conf import settings +from opaque_keys.edx.keys import CourseKey from pytest import mark -from unittest import TestCase # lint-amnesty, pylint: disable=wrong-import-order from common.djangoapps.course_modes.models import CourseMode from common.djangoapps.course_modes.tests.factories import CourseModeFactory -from opaque_keys.edx.keys import CourseKey # lint-amnesty, pylint: disable=wrong-import-order from common.djangoapps.student.tests.factories import UserFactory -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE -from xmodule.modulestore.tests.factories import CourseFactory - from openedx.core.djangoapps.catalog.tests.factories import ( ProgramFactory, ) -from openedx.features.enterprise_support.tests.factories import EnterpriseCustomerUserFactory from openedx.core.djangolib.testing.utils import skip_unless_lms +from openedx.features.enterprise_support.tests.factories import EnterpriseCustomerUserFactory +from xmodule.modulestore.django import modulestore +from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE +from xmodule.modulestore.tests.factories import CourseFactory if settings.ROOT_URLCONF == 'lms.urls': from openedx.core.djangoapps.demographics.api.status import show_user_demographics, show_call_to_action_for_user @@ -30,7 +29,10 @@ MICROBACHELORS = 'microbachelors' @skip_unless_lms @mock.patch('openedx.core.djangoapps.programs.utils.get_programs_by_type') -class TestShowDemographics(SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring +class TestShowDemographics(SharedModuleStoreTestCase): + """ + Tests for whether the demographics collection fields should be shown + """ MODULESTORE = TEST_DATA_SPLIT_MODULESTORE @classmethod @@ -57,7 +59,10 @@ class TestShowDemographics(SharedModuleStoreTestCase): # lint-amnesty, pylint: @skip_unless_lms @mark.django_db -class TestShowCallToAction(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring +class TestShowCallToAction(TestCase): + """ + Tests for whether the demographics call to action should be shown + """ def setUp(self): super().setUp() self.user = UserFactory()