mentat.datatype.test_internal module

Unit test module for testing the mentat.datatype.internal module.

class mentat.datatype.test_internal.TestMentatDatatypeInternal(methodName='runTest')[source]

Bases: unittest.case.TestCase

Unit test class for testing the mentat.datatype.internal module.

group_empty_raw = {'_id': 'abuse@cesnet.cz', 'managers': [], 'networks': [], 'rep_emails': ['abuse@muni.cz'], 'rep_filters': [], 'rep_mode': 'summary', 'rep_mute': 0, 'rep_redirect': 1, 'source': 'negistry', 'subnet_cache': 0, 'ts': 1493281523}
group_raw = {'_id': 'abuse@muni.cz', 'managers': [], 'networks': [{'network': '2001:718:805::/48', 'description': 'Masaryk University, Brno', '_id': 'rJraLUFYXe', 'last': 4.25406320428021e+37, 'netname': 'MUNI-CUST-6TCZ', 'source': 'negistry', 'type': 'ipv6'}, {'network': '2001:718:801::/48', 'description': 'Masaryk University, Brno', 'ip6_prefix': 48, 'ip6_addr': '2001:718:801::', 'last': 4.254063204279727e+37, 'netname': 'MUNI-6TCZ', 'first': 4.254063204279606e+37, 'source': 'negistry', '_id': 'PO7U6jBOcE', 'type': 'ipv6'}, {'network': '2001:718:800:1::/64', 'description': 'Masaryk University, Brno', 'ip6_prefix': 64, 'ip6_addr': '2001:718:800:1::', 'last': 4.254063204279485e+37, 'netname': 'MUNI-IC-6TCZ', 'first': 4.254063204279485e+37, 'source': 'negistry', '_id': 'mbqWk8R4ie', 'type': 'ipv6'}, {'network': '195.178.86.0-195.178.87.255', 'type': 'ipv4', 'description': 'Brno Academic Computer Network, Brno', '_id': 'jpEayOwZ8m', 'last': 3283245055, 'netname': 'BAPS-T34CZ', 'first': 3283244544, 'source': 'negistry', 'ip4_start': '195.178.86.0', 'ip4_end': '195.178.87.255'}, {'network': '147.251.0.0-147.251.255.255', 'description': 'Masaryk University, Brno', '_id': 'Hj3Tx0GG5T', 'last': 2482765823, 'netname': 'MUNI-TCZ', 'first': 2482700288, 'source': 'negistry', 'type': 'ipv4'}, {'network': '2001:718:800:5::/64', 'description': 'Masaryk University, Brno', '_id': 'SIfqthXOFx', 'last': 4.254063204279485e+37, 'netname': 'MUNI-CUST-IC-6TCZ', 'first': 4.254063204279485e+37, 'source': 'negistry', 'type': 'ipv6'}], 'rep_emails': ['abuse@muni.cz'], 'rep_filters': [], 'rep_mode': 'summary', 'rep_mute': 0, 'rep_redirect': 1, 'source': 'negistry', 'subnet_cache': 0, 'ts': 1493281523}
nr_records_few_raw = [{'network': '2001:718:805::/48', 'description': 'Masaryk University, Brno', '_id': 'rJraLUFYXe', 'last': 4.25406320428021e+37, 'netname': 'MUNI-CUST-6TCZ', 'source': 'negistry', 'type': 'ipv6'}, {'network': '2001:718:801::/48', 'description': 'Masaryk University, Brno', 'ip6_prefix': 48, 'ip6_addr': '2001:718:801::', 'last': 4.254063204279727e+37, 'netname': 'MUNI-6TCZ', 'first': 4.254063204279606e+37, 'source': 'negistry', '_id': 'PO7U6jBOcE', 'type': 'ipv6'}, {'network': '2001:718:800:1::/64', 'description': 'Masaryk University, Brno', 'ip6_prefix': 64, 'ip6_addr': '2001:718:800:1::', 'last': 4.254063204279485e+37, 'netname': 'MUNI-IC-6TCZ', 'first': 4.254063204279485e+37, 'source': 'negistry', '_id': 'mbqWk8R4ie', 'type': 'ipv6'}]
nr_records_raw = [{'network': '2001:718:805::/48', 'description': 'Masaryk University, Brno', '_id': 'rJraLUFYXe', 'last': 4.25406320428021e+37, 'netname': 'MUNI-CUST-6TCZ', 'source': 'negistry', 'type': 'ipv6'}, {'network': '2001:718:801::/48', 'description': 'Masaryk University, Brno', 'ip6_prefix': 48, 'ip6_addr': '2001:718:801::', 'last': 4.254063204279727e+37, 'netname': 'MUNI-6TCZ', 'first': 4.254063204279606e+37, 'source': 'negistry', '_id': 'PO7U6jBOcE', 'type': 'ipv6'}, {'network': '2001:718:800:1::/64', 'description': 'Masaryk University, Brno', 'ip6_prefix': 64, 'ip6_addr': '2001:718:800:1::', 'last': 4.254063204279485e+37, 'netname': 'MUNI-IC-6TCZ', 'first': 4.254063204279485e+37, 'source': 'negistry', '_id': 'mbqWk8R4ie', 'type': 'ipv6'}, {'network': '195.178.86.0-195.178.87.255', 'type': 'ipv4', 'description': 'Brno Academic Computer Network, Brno', '_id': 'jpEayOwZ8m', 'last': 3283245055, 'netname': 'BAPS-T34CZ', 'first': 3283244544, 'source': 'negistry', 'ip4_start': '195.178.86.0', 'ip4_end': '195.178.87.255'}, {'network': '147.251.0.0-147.251.255.255', 'description': 'Masaryk University, Brno', '_id': 'Hj3Tx0GG5T', 'last': 2482765823, 'netname': 'MUNI-TCZ', 'first': 2482700288, 'source': 'negistry', 'type': 'ipv4'}, {'network': '2001:718:800:5::/64', 'description': 'Masaryk University, Brno', '_id': 'SIfqthXOFx', 'last': 4.254063204279485e+37, 'netname': 'MUNI-CUST-IC-6TCZ', 'first': 4.254063204279485e+37, 'source': 'negistry', 'type': 'ipv6'}]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_01_conversions()[source]

Perform tests of parsing network records.

test_02_network_record()[source]

Perform tests of parsing network records.

test_03_abuse_group()[source]

Perform tests of parsing abuse groups.

test_04_user()[source]

Perform tests of parsing user accounts.

user_raw = {'_id': 'mach@cesnet.cz', 'affiliations': ['member@cesnet.cz', 'employee@cesnet.cz'], 'email': 'jan.mach@cesnet.cz', 'groups': ['abuse@cesnet.cz'], 'name': 'Jan Mach', 'organization': 'CESNET, z. s. p. o.', 'orggroups': ['cesnet:Employees', 'cesnet:CERTS'], 'query': [{'detector': 'au1/N6', '_id': 'N6', 'classification': '', 'datefrom': '', 'simple': 1, 'ipdst': '', 'ipsrc': '', 'dateto': '', 'query': '( Alert/Analyzer/@analyzerid EQ "au1" AND Alert/Analyzer/@name EQ "N6" )', 'ipor': 'FALSE'}], 'roles': ['admin', 'user'], 'ts': 1388577600, 'ts_last_login': 1505483119}
verbose = True