2021-01-08 19:35:16 -05:00
|
|
|
import unittest
|
|
|
|
|
2022-12-27 14:30:03 -05:00
|
|
|
from oslo_config import cfg
|
|
|
|
|
|
|
|
from aprsd import conf # noqa: F401
|
2021-08-19 11:39:29 -04:00
|
|
|
from aprsd.plugins import email
|
2021-01-08 19:35:16 -05:00
|
|
|
|
|
|
|
|
2022-12-27 14:30:03 -05:00
|
|
|
CONF = cfg.CONF
|
|
|
|
|
|
|
|
|
2021-01-08 19:35:16 -05:00
|
|
|
class TestEmail(unittest.TestCase):
|
|
|
|
def test_get_email_from_shortcut(self):
|
2022-12-27 14:30:03 -05:00
|
|
|
CONF.email_plugin.shortcuts = None
|
2021-01-08 19:35:16 -05:00
|
|
|
email_address = "something@something.com"
|
2021-08-23 12:14:19 -04:00
|
|
|
addr = f"-{email_address}"
|
2022-12-24 13:53:06 -05:00
|
|
|
actual = email.get_email_from_shortcut(addr)
|
2021-01-08 19:35:16 -05:00
|
|
|
self.assertEqual(addr, actual)
|
|
|
|
|
2022-12-27 14:30:03 -05:00
|
|
|
CONF.email_plugin.shortcuts = None
|
2022-12-24 13:53:06 -05:00
|
|
|
actual = email.get_email_from_shortcut(addr)
|
2021-01-08 19:35:16 -05:00
|
|
|
self.assertEqual(addr, actual)
|
|
|
|
|
2022-12-27 14:30:03 -05:00
|
|
|
CONF.email_plugin.shortcuts = None
|
2022-12-24 13:53:06 -05:00
|
|
|
actual = email.get_email_from_shortcut(addr)
|
2021-01-08 19:35:16 -05:00
|
|
|
self.assertEqual(addr, actual)
|
|
|
|
|
2022-12-27 14:30:03 -05:00
|
|
|
CONF.email_plugin.email_shortcuts = ["wb=something@something.com"]
|
|
|
|
email.shortcuts_dict = None
|
|
|
|
short = "wb"
|
2022-12-24 13:53:06 -05:00
|
|
|
actual = email.get_email_from_shortcut(short)
|
2021-01-08 19:35:16 -05:00
|
|
|
self.assertEqual(email_address, actual)
|