Example #1
0
 def process_exception(self, request, exception):
     request.exception = exception
     try:
         feedback = CuckooFeedback()
         feedback.send_exception(exception, request)
     except CuckooFeedbackError as e:
         log.warning("Error providing feedback to the backend: %s" % e)
Example #2
0
 def process_exception(self, request, exception):
     request.exception = exception
     try:
         feedback = CuckooFeedback()
         feedback.send_exception(exception, request)
     except CuckooFeedbackError as e:
         log.warning(
             "Error providing feedback to the backend: %s" % e
         )
Example #3
0
    def test_include_404_report(self, p, q):
        class request(object):
            method = "GET"

            class resolver_match(object):
                kwargs = {
                    "task_id": 1,
                }

        q._get_report.return_value = {}
        p.return_value.report = None
        p.return_value.validate.side_effect = CuckooFeedbackError

        with pytest.raises(CuckooFeedbackError):
            feedback = CuckooFeedback()
            feedback.send_exception(Exception, request)

        p.return_value.include_report_web.assert_called_once()
        p.return_value.include_analysis.assert_not_called()
Example #4
0
    def test_exception_no_analysis(self):
        feedback = CuckooFeedback()
        responses.add(responses.POST,
                      feedback.endpoint,
                      json={
                          "status": True,
                          "feedback_id": 1,
                      },
                      status=200)

        assert feedback.send_exception(Exception("Mock Exception"), None) == 1
Example #5
0
    def test_exception_no_analysis(self):
        feedback = CuckooFeedback()
        responses.add(
            responses.POST, feedback.endpoint, json={
                "status": True,
                "feedback_id": 1,
            }, status=200
        )

        assert feedback.send_exception(
            Exception("Mock Exception"), None
        ) == 1