2021-01-08 19:35:16 -05:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from aprsd import email
|
|
|
|
|
|
|
|
|
|
|
|
class TestEmail(unittest.TestCase):
|
|
|
|
def test_get_email_from_shortcut(self):
|
2021-01-21 13:32:19 -05:00
|
|
|
email.CONFIG = {"aprsd": {"email": {"shortcuts": {}}}}
|
2021-01-08 19:35:16 -05:00
|
|
|
email_address = "something@something.com"
|
|
|
|
addr = "-{}".format(email_address)
|
|
|
|
actual = email.get_email_from_shortcut(addr)
|
|
|
|
self.assertEqual(addr, actual)
|
|
|
|
|
2021-01-21 13:32:19 -05:00
|
|
|
email.CONFIG = {"aprsd": {"email": {"nothing": "nothing"}}}
|
2021-01-08 19:35:16 -05:00
|
|
|
actual = email.get_email_from_shortcut(addr)
|
|
|
|
self.assertEqual(addr, actual)
|
|
|
|
|
2021-01-21 13:32:19 -05:00
|
|
|
email.CONFIG = {"aprsd": {"email": {"shortcuts": {"not_used": "empty"}}}}
|
2021-01-08 19:35:16 -05:00
|
|
|
actual = email.get_email_from_shortcut(addr)
|
|
|
|
self.assertEqual(addr, actual)
|
|
|
|
|
2021-01-21 13:32:19 -05:00
|
|
|
email.CONFIG = {"aprsd": {"email": {"shortcuts": {"-wb": email_address}}}}
|
2021-01-08 19:35:16 -05:00
|
|
|
short = "-wb"
|
|
|
|
actual = email.get_email_from_shortcut(short)
|
|
|
|
self.assertEqual(email_address, actual)
|