Example #1
0
    def setup_http_not_allowed_list_test(self, user):
        repository = self.create_repository(tool_name='Test')
        review_request = self.create_review_request(repository=repository,
                                                    submitter=user,
                                                    publish=True)
        diffset = self.create_diffset(review_request)
        filediff = self.create_filediff(diffset)

        return get_patched_file_url(review_request, diffset, filediff)
    def setup_http_not_allowed_list_test(self, user):
        repository = self.create_repository(tool_name='Test')
        review_request = self.create_review_request(
            repository=repository,
            submitter=user,
            publish=True)
        diffset = self.create_diffset(review_request)
        filediff = self.create_filediff(diffset)

        return get_patched_file_url(review_request, diffset, filediff)
Example #3
0
    def setup_review_request_child_test(self, review_request):
        if not review_request.repository:
            repository = self.create_repository(public=False, tool_name='Test')
            repository.users.add(self.user)
            review_request.repository = repository
            review_request.save()

        diffset = self.create_diffset(review_request)
        filediff = self.create_filediff(diffset)

        return (get_patched_file_url(review_request, diffset,
                                     filediff), patched_file_mimetype)
    def setup_review_request_child_test(self, review_request):
        if not review_request.repository:
            repository = self.create_repository(public=False, tool_name='Test')
            repository.users.add(self.user)
            review_request.repository = repository
            review_request.save()

        diffset = self.create_diffset(review_request)
        filediff = self.create_filediff(diffset)

        return (get_patched_file_url(review_request, diffset, filediff),
                patched_file_mimetype)
    def setup_basic_get_test(self, user, with_local_site, local_site_name):
        repository = self.create_repository(tool_name='Test')
        review_request = self.create_review_request(
            repository=repository,
            with_local_site=with_local_site,
            submitter=user,
            publish=True)
        diffset = self.create_diffset(review_request)
        filediff = self.create_filediff(diffset)

        return (get_patched_file_url(review_request, diffset, filediff,
                                     local_site_name=local_site_name),
                patched_file_mimetype,
                filediff)
Example #6
0
    def setup_basic_get_test(self, user, with_local_site, local_site_name):
        repository = self.create_repository(tool_name='Test')
        review_request = self.create_review_request(
            repository=repository,
            with_local_site=with_local_site,
            submitter=user,
            publish=True)
        diffset = self.create_diffset(review_request)
        filediff = self.create_filediff(diffset)

        return (get_patched_file_url(review_request,
                                     diffset,
                                     filediff,
                                     local_site_name=local_site_name),
                patched_file_mimetype, filediff)
Example #7
0
    def test_with_draft_diff(self):
        """Testing the
        GET review-requests/<id>/diffs/<id>/files/<id>/patched-file/ API
        with draft diff
        """
        repository = self.create_repository(tool_name='Test')
        review_request = self.create_review_request(repository=repository,
                                                    submitter=self.user,
                                                    publish=True)
        diffset = self.create_diffset(review_request, draft=True)
        filediff = self.create_filediff(diffset)

        rsp = self.api_get(get_patched_file_url(review_request, diffset,
                                                filediff),
                           expected_status=404)
        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DOES_NOT_EXIST.code)
    def test_with_draft_diff(self):
        """Testing the
        GET review-requests/<id>/diffs/<id>/files/<id>/patched-file/ API
        with draft diff
        """
        repository = self.create_repository(tool_name='Test')
        review_request = self.create_review_request(
            repository=repository,
            submitter=self.user,
            publish=True)
        diffset = self.create_diffset(review_request, draft=True)
        filediff = self.create_filediff(diffset)

        rsp = self.api_get(
            get_patched_file_url(review_request, diffset, filediff),
            expected_status=404)
        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DOES_NOT_EXIST.code)