예제 #1
0
    def post(self, user, data=None):
        if data is None:
            data = {
                'name': 'A test image',
                'description': 'Test image description',
                'file': get_image()
            }

        url = reverse(
            'api:grouping_media',
            kwargs={
                'project_id': self.project.id,
                'grouping_id': self.grouping.id,
                'contribution_id': self.contribution.id
            }
        )

        request = self.factory.post(url, data)
        force_authenticate(request, user)
        view = GroupingContributionsMediaApiView.as_view()
        return view(
            request,
            project_id=self.project.id,
            grouping_id=self.grouping.id,
            contribution_id=self.contribution.id
        ).render()
예제 #2
0
    def get(self, user):
        url = reverse('api:grouping_media',
                      kwargs={
                          'project_id': self.project.id,
                          'grouping_id': self.grouping.id,
                          'contribution_id': self.contribution.id
                      })

        request = self.factory.get(url)
        force_authenticate(request, user)
        view = GroupingContributionsMediaApiView.as_view()
        return view(request,
                    project_id=self.project.id,
                    grouping_id=self.grouping.id,
                    contribution_id=self.contribution.id).render()
예제 #3
0
    def get(self, user):
        url = reverse(
            'api:grouping_media',
            kwargs={
                'project_id': self.project.id,
                'grouping_id': self.grouping.id,
                'contribution_id': self.contribution.id
            }
        )

        request = self.factory.get(url)
        force_authenticate(request, user)
        view = GroupingContributionsMediaApiView.as_view()
        return view(
            request,
            project_id=self.project.id,
            grouping_id=self.grouping.id,
            contribution_id=self.contribution.id
        ).render()
예제 #4
0
    def post(self, user, data=None):
        if data is None:
            data = {
                'name': 'A test image',
                'description': 'Test image description',
                'file': get_image()
            }

        url = reverse('api:grouping_media',
                      kwargs={
                          'project_id': self.project.id,
                          'grouping_id': self.grouping.id,
                          'contribution_id': self.contribution.id
                      })

        request = self.factory.post(url, data)
        force_authenticate(request, user)
        view = GroupingContributionsMediaApiView.as_view()
        return view(request,
                    project_id=self.project.id,
                    grouping_id=self.grouping.id,
                    contribution_id=self.contribution.id).render()