This commit is contained in:
2026-02-04 12:45:35 -05:00
parent 0a27b763f7
commit 700ea8d6a4
51 changed files with 4715 additions and 2904 deletions
+25
View File
@@ -0,0 +1,25 @@
import pytest
from hbd.proto import dicttos, stodict, oldmtodict
def test_dicttos_and_stodict_uncompressed():
msg = dicttos("HTB", {"name": "host.example", "interval": 10})
d = stodict(msg)
assert d["ID"].startswith("HTB")
assert d["name"] == "host.example"
assert d["interval"] == 10
def test_dicttos_and_stodict_compressed():
msg = dicttos("ACK", {"time": 12345}, compress=True)
d = stodict(msg)
# for compressed the original code included the colon in ID slice; ensure no crash
assert "ID" in d
def test_oldmtodict():
msg = b"name=foo;interval=5"
d = oldmtodict(msg)
assert d["ID"].startswith("HTB")
assert d["name"] == "foo"
assert d["interval"] == 5