Example #1
0
    def test_number_of_new_false_positives(self):
        # Add a couple of false positives to database as new issues,
        # and check that the they're counted properly
        response = {'scenario_id': '1',
                    'req_headers': 'headers',
                    'req_body': 'body',
                    'url': 'url',
                    'req_method': 'method',
                    'timestamp': datetime.datetime.utcnow(),
                    'server_protocol_error': None,
                    'server_timeout': False,
                    'server_error_text_detected': False,
                    'server_error_text_matched': 'matched_text',
                    'resp_statuscode': 'statuscode',
                    'resp_headers': 'resp_headers',
                    'resp_body': 'resp_body',
                    'resp_history': 'resp_history'}

        # Add one, expect count to be 1
        dbtools.add_false_positive(self.context, response)
        self.assertEqual(dbtools.number_of_new_in_database(self.context),
                         1, "After adding one, no one finding in database")

        # Add a second one, expect count to be 2
        dbtools.add_false_positive(self.context, response)
        self.assertEqual(dbtools.number_of_new_in_database(self.context),
                         2, "After adding two, no two findings in db")
Example #2
0
    def test_number_of_new_false_positives(self):
        # Add a couple of false positives to database as new issues,
        # and check that the they're counted properly
        response = {
            'scenario_id': '1',
            'req_headers': 'headers',
            'req_body': 'body',
            'url': 'url',
            'req_method': 'method',
            'timestamp': datetime.datetime.utcnow(),
            'server_protocol_error': None,
            'server_timeout': False,
            'server_error_text_detected': False,
            'server_error_text_matched': 'matched_text',
            'resp_statuscode': 'statuscode',
            'resp_headers': 'resp_headers',
            'resp_body': 'resp_body',
            'resp_history': 'resp_history'
        }

        # Add one, expect count to be 1
        dbtools.add_false_positive(self.context, response)
        self.assertEqual(dbtools.number_of_new_in_database(self.context), 1,
                         "After adding one, no one finding in database")

        # Add a second one, expect count to be 2
        dbtools.add_false_positive(self.context, response)
        self.assertEqual(dbtools.number_of_new_in_database(self.context), 2,
                         "After adding two, no two findings in db")
Example #3
0
def step_impl(context):
    """Check whether we stored any new findings
    """
    if context.new_findings > 0:
        assert False, "%s new findings were found." % context.new_findings
    old_findings = fuzzdb.number_of_new_in_database(context)
    if old_findings > 0:
        assert False, "No new findings found, but %s unprocessed findings from past runs found in database." % old_findings
    assert True
Example #4
0
def step_impl(context):
    """Check whether we stored any new findings
    """
    if context.new_findings > 0:
        assert False, "%s new findings were found." % context.new_findings
    old_findings = fuzzdb.number_of_new_in_database(context)
    if old_findings > 0:
        assert False, "No new findings found, but %s unprocessed findings from past runs found in database." % old_findings
    assert True