Exemple #1
0
 def _response_context(self, user, user_demographics=None):  # lint-amnesty, pylint: disable=missing-function-docstring
     if user_demographics:
         show_call_to_action = user_demographics.show_call_to_action
     else:
         show_call_to_action = show_call_to_action_for_user(user)
     return {
         'display': show_user_demographics(user),
         'show_call_to_action': show_call_to_action
     }
Exemple #2
0
    def get(self, request):
        """
        GET /api/user/v1/accounts/demographics_status

        This is a Web API to determine whether or not we should show Demographics to a learner
        based on their enrollment status.
        """
        user = request.user
        return Response({'display': show_user_demographics(user)})
Exemple #3
0
 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:
         show_call_to_action = show_call_to_action_for_user(user)
     return {
         'display': show_user_demographics(user),
         'show_call_to_action': show_call_to_action
     }
Exemple #4
0
 def test_user_enterprise(self, mock_get_programs_by_type):
     mock_get_programs_by_type.return_value = [self.program]
     EnterpriseCustomerUserFactory.create(user_id=self.user.id)
     assert not show_user_demographics(user=self.user)