Ejemplo n.º 1
0
    def setup_basic_get_test(self, user, with_local_site, local_site_name):
        review_request = self.create_review_request(
            with_local_site=with_local_site, submitter=user, publish=True)
        status_update = self.create_status_update(review_request, user=user)

        return (get_status_update_item_url(review_request, status_update.pk,
                                           local_site_name),
                status_update_item_mimetype, status_update)
Ejemplo n.º 2
0
    def setup_basic_delete_test(self, user, with_local_site, local_site_name):
        review_request = self.create_review_request(
            with_local_site=with_local_site,
            submitter=user,
            publish=True)
        status_update = self.create_status_update(review_request, user=user)

        return (get_status_update_item_url(review_request, status_update.pk,
                                           local_site_name),
                [status_update, review_request])
Ejemplo n.º 3
0
    def test_get_not_modified(self):
        """Testing the GET review-requests/<id>/status-updates/<id>/ API
        with Not Modified response
        """
        review_request = self.create_review_request(publish=True)
        status_update = self.create_status_update(review_request)

        self._testHttpCaching(get_status_update_item_url(
            review_request, status_update.pk),
                              check_etags=True)
Ejemplo n.º 4
0
    def test_get_not_modified(self):
        """Testing the GET <URL> API
        with Not Modified response
        """
        review_request = self.create_review_request(publish=True)
        status_update = self.create_status_update(review_request)

        self._testHttpCaching(
            get_status_update_item_url(review_request, status_update.pk),
            check_etags=True)
Ejemplo n.º 5
0
    def test_get_not_modified(self):
        """Testing the GET <URL> API
        with Not Modified response
        """
        review_request = self.create_review_request(publish=True)
        status_update = self.create_status_update(review_request)

        with override_feature_checks(self.override_features):
            self._testHttpCaching(get_status_update_item_url(
                review_request, status_update.pk),
                                  check_etags=True)
Ejemplo n.º 6
0
    def test_delete_with_does_not_exist(self):
        """Testing the DELETE review-requests/<id>/status-updates/<id>/ API
        with Does Not Exist error
        """
        review_request = self.create_review_request(publish=True)

        rsp = self.api_delete(get_status_update_item_url(
            review_request, 12345),
                              expected_status=404)
        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DOES_NOT_EXIST.code)
Ejemplo n.º 7
0
    def test_delete_with_does_not_exist(self):
        """Testing the DELETE <URL> API
        with Does Not Exist error
        """
        review_request = self.create_review_request(publish=True)

        rsp = self.api_delete(
            get_status_update_item_url(review_request, 12345),
            expected_status=404)
        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DOES_NOT_EXIST.code)
Ejemplo n.º 8
0
    def setup_basic_put_test(self, user, with_local_site, local_site_name,
                             put_valid_data):
        review_request = self.create_review_request(
            with_local_site=with_local_site, submitter=user, publish=True)
        review = self.create_review(review_request=review_request)
        status_update = self.create_status_update(review_request, user=user)

        return (get_status_update_item_url(review_request, status_update.pk,
                                           local_site_name),
                status_update_item_mimetype, {
                    'summary': 'New summary',
                    'review_id': review.pk,
                }, status_update, [])
Ejemplo n.º 9
0
    def test_delete_with_does_not_exist(self):
        """Testing the DELETE <URL> API
        with Does Not Exist error
        """
        review_request = self.create_review_request(publish=True)

        with override_feature_checks(self.override_features):
            rsp = self.api_delete(get_status_update_item_url(
                review_request, 12345),
                                  expected_status=404)

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DOES_NOT_EXIST.code)
Ejemplo n.º 10
0
    def test_status_update_request_run_not_runnable(self):
        """Testing the PUT <URL> API with a status update that cannot be run"""
        review_request = self.create_review_request(publish=True)
        status_update = self.create_status_update(
            review_request=review_request,
            user=self.user,
            state=StatusUpdate.DONE_SUCCESS)

        with override_feature_checks(self.override_features):
            rsp = self.api_put(get_status_update_item_url(
                review_request, status_update.pk), {'state': 'request-run'},
                               expected_status=400)

            self.assertEqual(rsp['stat'], 'fail')
            self.assertEqual(rsp['err']['code'], INVALID_FORM_DATA.code)
            self.assertEqual(rsp['fields']['state'],
                             ['This status update cannot be run'])
Ejemplo n.º 11
0
    def test_status_update_request_run(self):
        """Testing the PUT <URL> API with a runnable status update"""
        review_request = self.create_review_request(publish=True)
        status_update = self.create_status_update(
            review_request=review_request,
            user=self.user,
            state=StatusUpdate.NOT_YET_RUN)

        self.spy_on(status_update_request_run.send)

        with override_feature_checks(self.override_features):
            rsp = self.api_put(get_status_update_item_url(
                review_request, status_update.pk), {'state': 'request-run'},
                               expected_status=200,
                               expected_mimetype=status_update_item_mimetype)

        self.assertEqual(rsp['stat'], 'ok')
        self.assertSpyCalledWith(status_update_request_run.send,
                                 status_update=status_update)
Ejemplo n.º 12
0
    def setup_basic_put_test(self, user, with_local_site, local_site_name,
                             put_valid_data):
        review_request = self.create_review_request(
            with_local_site=with_local_site,
            submitter=user,
            publish=True)
        review = self.create_review(review_request=review_request)
        status_update = self.create_status_update(review_request, user=user)

        return (
            get_status_update_item_url(review_request, status_update.pk,
                                       local_site_name),
            status_update_item_mimetype,
            {
                'summary': 'New summary',
                'review_id': review.pk,
            },
            status_update,
            [])
Ejemplo n.º 13
0
    def setup_review_request_child_test(self, review_request):
        status_update = self.create_status_update(review_request)

        return (get_status_update_item_url(review_request, status_update.pk),
                status_update_item_mimetype)
Ejemplo n.º 14
0
    def setup_review_request_child_test(self, review_request):
        status_update = self.create_status_update(review_request)

        return (get_status_update_item_url(review_request, status_update.pk),
                status_update_item_mimetype)