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