

def test_false_positive_detection(self):
    response = {
        'scenario_id': '1',
        'req_headers': 'headers',
        'req_body': 'body',
        'url': 'url',
        'req_method': 'method',
        'timestamp': datetime.datetime.utcnow(),
        'server_protocol_error': False,
        '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',
    }
    dbtools.add_false_positive(self.context, response)
    self.assertEqual(dbtools.known_false_positive(self.context, response), True, 'Duplicate false positive not detected')
    response['scenario_id'] = '2'
    self.assertEqual(dbtools.known_false_positive(self.context, response), False, 'Not a duplicate: scenario_id different')
    dbtools.add_false_positive(self.context, response)
    response['server_protocol_error'] = 'Error text'
    self.assertEqual(dbtools.known_false_positive(self.context, response), False, 'Not a duplicate: server_protocol_error different')
    dbtools.add_false_positive(self.context, response)
    response['resp_statuscode'] = '500'
    self.assertEqual(dbtools.known_false_positive(self.context, response), False, 'Not a duplicate: resp_statuscode different')
    dbtools.add_false_positive(self.context, response)
    response['server_timeout'] = True
    self.assertEqual(dbtools.known_false_positive(self.context, response), False, 'Not a duplicate: server_timeout different')
    dbtools.add_false_positive(self.context, response)
    response['server_error_text_detected'] = True
    self.assertEqual(dbtools.known_false_positive(self.context, response), False, 'Not a duplicate: server_error_text_detected different')
    dbtools.add_false_positive(self.context, response)
    self.assertEqual(dbtools.known_false_positive(self.context, response), True, 'A duplicate case not detected')

dataset/ETHPy150Open F-Secure/mittn/mittn/httpfuzzer/test_dbtools.py dbtools_test_case.test_false_positive_detection/original