1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-06-01 13:45:06 -04:00

Got unit tests working again

This commit is contained in:
2024-04-01 21:46:23 -04:00
parent a270c75263
commit f92b2ee364
6 changed files with 29 additions and 18 deletions
+5 -8
View File
@@ -1,3 +1,5 @@
from unittest import mock
from oslo_config import cfg
import aprsd
@@ -11,7 +13,9 @@ CONF = cfg.CONF
class TestVersionPlugin(test_plugin.TestPlugin):
def test_version(self):
@mock.patch("aprsd.stats.app.APRSDStats.uptime")
def test_version(self, mock_stats):
mock_stats.return_value = "00:00:00"
expected = f"APRSD ver:{aprsd.__version__} uptime:00:00:00"
CONF.callsign = fake.FAKE_TO_CALLSIGN
version = version_plugin.VersionPlugin()
@@ -31,10 +35,3 @@ class TestVersionPlugin(test_plugin.TestPlugin):
)
actual = version.filter(packet)
self.assertEqual(expected, actual)
packet = fake.fake_packet(
message="Version",
msg_number=1,
)
actual = version.filter(packet)
self.assertEqual(expected, actual)
+1 -2
View File
@@ -6,7 +6,7 @@ from oslo_config import cfg
from aprsd import conf # noqa: F401
from aprsd import packets
from aprsd import plugin as aprsd_plugin
from aprsd import plugins, stats
from aprsd import plugins
from aprsd.packets import core
from . import fake
@@ -89,7 +89,6 @@ class TestPlugin(unittest.TestCase):
self.config_and_init()
def tearDown(self) -> None:
stats.APRSDStats._instance = None
packets.WatchList._instance = None
packets.SeenList._instance = None
packets.PacketTrack._instance = None