Esempio n. 1
0
    def get(self, request, share_id):
        """
        Retrieve an aggregate

        Return details on an individual aggregate specified by it's shared ID.

            {method} {path}

        Note: This is not the equivilant of what you'd receive with the standard
        group details endpoint. Data is more restrictive and designed
        specifically for sharing.

        """
        try:
            group = Group.from_share_id(share_id)
        except Group.DoesNotExist:
            raise ResourceDoesNotExist

        if group.organization.flags.disable_shared_issues:
            raise ResourceDoesNotExist

        event = group.get_latest_event()

        context = serialize(
            group, request.user,
            SharedGroupSerializer(
                environment_id_func=self._get_environment_id_func(
                    request, group.project.organization_id)))
        # TODO(dcramer): move latestEvent/project into SharedGroupSerializer
        context['latestEvent'] = serialize(event, request.user,
                                           SharedEventSerializer())
        context['project'] = serialize(group.project, request.user,
                                       SharedProjectSerializer())
        return Response(context)
Esempio n. 2
0
    def get(self, request, share_id):
        """
        Retrieve an aggregate

        Return details on an individual aggregate specified by it's shared ID.

            {method} {path}

        Note: This is not the equivilant of what you'd receive with the standard
        group details endpoint. Data is more restrictive and designed
        specifically for sharing.

        """
        try:
            group = Group.from_share_id(share_id)
        except Group.DoesNotExist:
            raise ResourceDoesNotExist

        if group.organization.flags.disable_shared_issues:
            raise ResourceDoesNotExist

        event = group.get_latest_event()

        context = serialize(group, request.user, SharedGroupSerializer())
        context['latestEvent'] = serialize(event, request.user, SharedEventSerializer())

        # TODO(dcramer): use specific serializer for public group and embed
        # event details as part of api response
        return Response(context)
    def get(self, request, share_id):
        """
        Retrieve an aggregate

        Return details on an individual aggregate specified by it's shared ID.

            {method} {path}

        Note: This is not the equivilant of what you'd receive with the standard
        group details endpoint. Data is more restrictive and designed
        specifically for sharing.

        """
        try:
            group = Group.from_share_id(share_id)
        except Group.DoesNotExist:
            raise ResourceDoesNotExist

        event = group.get_latest_event()

        context = serialize(group, request.user, SharedGroupSerializer())
        context['latestEvent'] = serialize(event, request.user, SharedEventSerializer())

        # TODO(dcramer): use specific serializer for public group and embed
        # event details as part of api response
        return Response(context)
Esempio n. 4
0
    def get(self, request):
        """
        Retrieve an aggregate

        Return details on an individual aggregate specified by query parameters.

            {method} {path}?shareId=mnIX

        """
        share_id = request.GET.get('shareId')
        if share_id:
            try:
                group = Group.from_share_id(share_id)
            except Group.DoesNotExist:
                group = None
        else:
            group = None

        if not group:
            return Response({'detail': 'No groups found'}, status=404)

        return client.get('/groups/{}/'.format(group.id), request.user, request.auth)
    def get(self, request):
        """
        Retrieve an aggregate

        Return details on an individual aggregate specified by query parameters.

            {method} {path}?shareId=mnIX

        """
        share_id = request.GET.get('shareId')
        if share_id:
            try:
                group = Group.from_share_id(share_id)
            except Group.DoesNotExist:
                group = None
        else:
            group = None

        if not group:
            return Response({'detail': 'No groups found'}, status=404)

        return client.get('/groups/{}/'.format(group.id), request.user,
                          request.auth)
Esempio n. 6
0
 def test_invalid_shared_id(self):
     with pytest.raises(Group.DoesNotExist):
         Group.from_share_id('adc7a5b902184ce3818046302e94f8ec')
Esempio n. 7
0
 def test_invalid_shared_id(self):
     with pytest.raises(Group.DoesNotExist):
         Group.from_share_id('adc7a5b902184ce3818046302e94f8ec')