def recompute_portal(request): serializer = RecomputePortalSerializer(data=request.data) if serializer.is_valid(): global_ids = serializer.data['global_ids'] if serializer.data['global_ids'] else None if application_json.publish_to_portal(global_ids): return Response(status=status.HTTP_202_ACCEPTED) return Response(status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def test_build_attributions_json(self, mock_send_message): application_list = application_json._compute_list() self.assertIsInstance(application_list, list) self.assertEqual(len(application_list), 1) application_json.publish_to_portal() self.assertTrue(mock_send_message.called)
def publish_application_to_portal(self, request, queryset): from attribution.business import application_json global_ids = list(queryset.values_list('tutor__person__global_id', flat=True)) return application_json.publish_to_portal(global_ids)