def test_serialize_deserialize(self): try: raise KeyError except Exception, e: except_type, except_class, tb = sys.exc_info() enabled_plugins = '{}' fr = self.get_fuzzable_request() core = w3afCore() status = CoreStatus(core) status.set_running_plugin('audit', 'sqli', log=False) status.set_current_fuzzable_request('audit', fr) exception_data = ExceptionData(status, e, tb, enabled_plugins, store_tb=False) pickled_ed = cPickle.dumps(exception_data) unpickled_ed = cPickle.loads(pickled_ed) self.assertEqual(exception_data.to_json(), unpickled_ed.to_json())
def test_without_traceback(self): tb = None enabled_plugins = '{}' fr = self.get_fuzzable_request() core = w3afCore() status = CoreStatus(core) status.set_running_plugin('audit', 'sqli', log=False) status.set_current_fuzzable_request('audit', fr) exception_data = ExceptionData(status, KeyError(), tb, enabled_plugins, store_tb=False) pickled_ed = cPickle.dumps(exception_data) unpickled_ed = cPickle.loads(pickled_ed) self.assertEqual(exception_data.to_json(), unpickled_ed.to_json())