1
0
mirror of https://github.com/craigerl/aprsd.git synced 2026-03-31 20:25:34 -04:00

fix: Update test to work with singleton pattern

The APRSISDriver uses @singleton decorator which transforms the class
into a function. The test was incorrectly trying to use __new__ which
doesn't work with decorated singletons. Instead, re-initialize the
existing instance after changing the config.
This commit is contained in:
Walter Boring 2026-03-27 10:13:55 -04:00
parent 930339d4cf
commit f6eb383caf

View File

@ -83,11 +83,11 @@ class TestAPRSISDriver(unittest.TestCase):
# Set a custom stale_timeout
self.mock_conf.aprs_network.stale_timeout = 60 # 1 minute
# Create a new driver instance with custom timeout
driver = APRSISDriver.__new__(APRSISDriver)
driver.__init__()
# Re-initialize the existing driver with new config
# (singleton pattern means we can't create a new instance)
self.driver.__init__()
self.assertEqual(driver.max_delta, datetime.timedelta(seconds=60))
self.assertEqual(self.driver.max_delta, datetime.timedelta(seconds=60))
def test_is_enabled_true(self):
"""Test is_enabled returns True when APRS-IS is enabled."""