22import os
33from pathlib import Path
44
5- from l9format import l9format
5+ from l9format import L9Event
66
77TESTS_DIR = Path (os .path .dirname (__file__ ))
88
1616def test_l9event_json_from_reference_repository ():
1717 path = TESTS_DIR / "l9event.json"
1818 c = json .load (open (str (path ), "r" ))
19- l9format . L9Event .from_dict (c )
19+ L9Event .from_dict (c )
2020
2121
2222def test_l9events_form_ip4scout ():
2323 for path in IP4SCOUT_FILES :
2424 c = json .load (open (str (path ), "r" ))
25- l9format . L9Event .from_dict (c )
25+ L9Event .from_dict (c )
2626
2727
2828def test_iso8601_nanosecond_parsing ():
@@ -36,10 +36,50 @@ def test_iso8601_nanosecond_parsing():
3636 c = json .load (open (str (path ), "r" ))
3737 # Use a timestamp with nanosecond precision (9 decimal places)
3838 c ["time" ] = "2023-10-05T23:30:36.823867784Z"
39- event = l9format . L9Event .from_dict (c )
39+ event = L9Event .from_dict (c )
4040 assert event .time .year == 2023
4141 assert event .time .month == 10
4242 assert event .time .day == 5
4343 assert event .time .hour == 23
4444 assert event .time .minute == 30
4545 assert event .time .second == 36
46+
47+
48+ def test_all_models_importable_from_package ():
49+ """Verify all public models are importable from the l9format package."""
50+ import l9format
51+
52+ expected_models = [
53+ "Certificate" ,
54+ "DatasetSummary" ,
55+ "GeoLocation" ,
56+ "GeoPoint" ,
57+ "L9Aggregation" ,
58+ "L9AMQPEvent" ,
59+ "L9DNSEvent" ,
60+ "L9Event" ,
61+ "L9FTPEvent" ,
62+ "L9HttpEvent" ,
63+ "L9LDAPEvent" ,
64+ "L9LeakEvent" ,
65+ "L9MemcachedEvent" ,
66+ "L9MongoDBEvent" ,
67+ "L9MySQLEvent" ,
68+ "L9PostgreSQLEvent" ,
69+ "L9RDPEvent" ,
70+ "L9RedisEvent" ,
71+ "L9RTSPEvent" ,
72+ "L9ServiceEvent" ,
73+ "L9SIPEvent" ,
74+ "L9SMTPEvent" ,
75+ "L9SSHEvent" ,
76+ "L9SSLEvent" ,
77+ "L9TelnetEvent" ,
78+ "L9VNCEvent" ,
79+ "Network" ,
80+ "ServiceCredentials" ,
81+ "Software" ,
82+ "SoftwareModule" ,
83+ ]
84+ for name in expected_models :
85+ assert hasattr (l9format , name ), f"{ name } not importable from l9format"
0 commit comments