def get_consent_record(self, request): """ Get the consent record relevant to the request at hand. """ username, course_id, program_uuid, enterprise_customer_uuid = self.get_required_query_params( request) dsc = get_data_sharing_consent(username, enterprise_customer_uuid, course_id=course_id, program_uuid=program_uuid) if not dsc: log_message = ( '[Enterprise Consent API] The code was unable to get consent data for the user. ' 'Course: {course_id}, ' 'Program: {program_uuid}, ' 'EnterpriseCustomer: {enterprise_customer_uuid}, ' 'User: {username}, ' 'ErrorCode: {error_code}'.format( course_id=course_id, program_uuid=program_uuid, enterprise_customer_uuid=enterprise_customer_uuid, username=username, error_code='ENTGDS001', )) LOGGER.error(log_message) return dsc
def get_consent_record(self, request): """ Get the consent record relevant to the request at hand. """ username, course_id, program_uuid, enterprise_customer_uuid = self.get_required_query_params( request) return get_data_sharing_consent(username, enterprise_customer_uuid, course_id=course_id, program_uuid=program_uuid)
def test_get_data_sharing_consent_no_enterprise(self): """ Test that the returned consent record is None when no EnterpriseCustomer exists. """ assert helpers.get_data_sharing_consent( 'bob', TEST_UUID, course_id='fake-course') is None