mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-17 13:51:54 -05:00
Hemna
5f4cf89733
This patch refactors how the recieved message processing happens. We now handle all incoming packets the same. Removed the notification thread to handle the watchlist packets. This is now done with a unified plugins architecture that allows different capabilities via the new plugin structure. All packets sent to us will be sent through all of the plugins. It's the plugins job to decide what to do with that packet or ignore it. Email is no longer a special case for the most part. All email functions have been migrated to the EmailPlugin, including starting the EmailThread, which works in the background to check for new emails and send those to the registered callsign. The EmailPlugin now starts the EmailThread itself. All plugins are now build on the new APRSDPluginBase which has a common set of features. The APRSDPluginBase calls self.setup() upon creation, which allows all plugins to do whatever they want for initiali startup. The EmailPlugin uses setup() to start the EmailThread if email is enabled.
26 lines
915 B
Python
26 lines
915 B
Python
import unittest
|
|
|
|
from aprsd.plugins import email
|
|
|
|
|
|
class TestEmail(unittest.TestCase):
|
|
def test_get_email_from_shortcut(self):
|
|
email.CONFIG = {"aprsd": {"email": {"shortcuts": {}}}}
|
|
email_address = "something@something.com"
|
|
addr = f"-{email_address}"
|
|
actual = email.get_email_from_shortcut(addr)
|
|
self.assertEqual(addr, actual)
|
|
|
|
email.CONFIG = {"aprsd": {"email": {"nothing": "nothing"}}}
|
|
actual = email.get_email_from_shortcut(addr)
|
|
self.assertEqual(addr, actual)
|
|
|
|
email.CONFIG = {"aprsd": {"email": {"shortcuts": {"not_used": "empty"}}}}
|
|
actual = email.get_email_from_shortcut(addr)
|
|
self.assertEqual(addr, actual)
|
|
|
|
email.CONFIG = {"aprsd": {"email": {"shortcuts": {"-wb": email_address}}}}
|
|
short = "-wb"
|
|
actual = email.get_email_from_shortcut(short)
|
|
self.assertEqual(email_address, actual)
|