mentat.reports.test_utils module

Unit test module for testing the mentat.reports.utils module.

class mentat.reports.test_utils.TestMentatReportsUtils(methodName='runTest')[source]

Bases: unittest.case.TestCase

Unit test class for testing the mentat.reports.utils module.

ideas_obj = [Idea({'Format': 'IDEA0', '_CESNET': CESNETDict({'ResolvedAbuses': ResolvedAbusesList(['abuse@cesnet.cz']), 'EventClass': 'class01', 'EventSeverity': 'low'}), 'Source': SourceList([SourceTargetDict({'IP6': Net6([IP6Net('2001:db8::ff00:42:0/112')]), 'IP4': Net4([IP4Range('192.168.0.2-192.168.0.5'), IP4Net('192.168.0.0/25'), IP4('10.0.0.1')])})]), 'Category': EventTag(['Fraud.Phishing']), 'Description': 'Synthetic example 01', 'Node': NodeList([NodeDict({'SW': String(['Kippo']), 'Name': 'org.example.kippo_honey'})]), 'Target': TargetList([SourceTargetDict({'IP6': Net6([IP6Net('2001:ffff::ff00:42:0/112')]), 'IP4': Net4([IP4Net('10.2.2.0/24')])})]), 'DetectTime': datetime.datetime(2018, 1, 1, 12, 0), 'ID': 'msg01'}), Idea({'Format': 'IDEA0', '_CESNET': CESNETDict({'ResolvedAbuses': ResolvedAbusesList(['abuse@cesnet.cz']), 'EventClass': 'class02', 'EventSeverity': 'low'}), 'Source': SourceList([SourceTargetDict({'IP6': Net6([IP6Net('2002:db8::ff00:42:0/112')]), 'IP4': Net4([IP4Range('192.168.1.2-192.168.1.5'), IP4Net('192.169.0.0/25'), IP4('10.0.0.1')])})]), 'Category': EventTag(['Recon.Scanning']), 'Description': 'Synthetic example 02', 'Node': NodeList([NodeDict({'SW': String(['Dionaea']), 'Name': 'org.example.dionaea'})]), 'Target': TargetList([SourceTargetDict({'IP6': Net6([IP6Net('2004:ffff::ff00:42:0/112')]), 'IP4': Net4([IP4Net('11.2.2.0/24')])})]), 'DetectTime': datetime.datetime(2018, 1, 1, 13, 0), 'ID': 'msg02'})]
ideas_raw = [{'Format': 'IDEA0', '_CESNET': {'ResolvedAbuses': ['abuse@cesnet.cz'], 'EventSeverity': 'low', 'EventClass': 'class01'}, 'Source': [{'IP6': ['2001:db8::ff00:42:0/112'], 'IP4': ['192.168.0.2-192.168.0.5', '192.168.0.0/25', '10.0.0.1']}], 'Category': ['Fraud.Phishing'], 'Description': 'Synthetic example 01', 'Node': [{'SW': ['Kippo'], 'Name': 'org.example.kippo_honey'}], 'Target': [{'IP6': ['2001:ffff::ff00:42:0/112'], 'IP4': ['10.2.2.0/24']}], 'DetectTime': '2018-01-01T12:00:00Z', 'ID': 'msg01'}, {'Format': 'IDEA0', '_CESNET': {'ResolvedAbuses': ['abuse@cesnet.cz'], 'EventSeverity': 'low', 'EventClass': 'class02'}, 'Source': [{'IP6': ['2002:db8::ff00:42:0/112'], 'IP4': ['192.168.1.2-192.168.1.5', '192.169.0.0/25', '10.0.0.1']}], 'Category': ['Recon.Scanning'], 'Description': 'Synthetic example 02', 'Node': [{'SW': ['Dionaea'], 'Name': 'org.example.dionaea'}], 'Target': [{'IP6': ['2004:ffff::ff00:42:0/112'], 'IP4': ['11.2.2.0/24']}], 'DetectTime': '2018-01-01T13:00:00Z', 'ID': 'msg02'}]
setUp()[source]

Perform test case setup.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_01_generate_cache_keys()[source]

Test mentat.reports.utils.ThresholdingCache._generate_cache_keys() function.

test_02_no_thr_cache()[source]

Test mentat.reports.utils.NoThresholdingCache() class.

test_03_storage_thr_cache()[source]

Test mentat.reports.utils.StorageThresholdingCache() class.

test_04_reporting_settings()[source]

Test mentat.reports.utils.ReportingSettings class.

verbose = True