1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-21 15:51:52 -05:00
aprsd/tests/test_email.py
Hemna 7ccfc253cf Removed references to old custom config
Also updated unittests to pass.
2022-12-27 14:30:03 -05:00

33 lines
942 B
Python

import unittest
from oslo_config import cfg
from aprsd import conf # noqa: F401
from aprsd.plugins import email
CONF = cfg.CONF
class TestEmail(unittest.TestCase):
def test_get_email_from_shortcut(self):
CONF.email_plugin.shortcuts = None
email_address = "something@something.com"
addr = f"-{email_address}"
actual = email.get_email_from_shortcut(addr)
self.assertEqual(addr, actual)
CONF.email_plugin.shortcuts = None
actual = email.get_email_from_shortcut(addr)
self.assertEqual(addr, actual)
CONF.email_plugin.shortcuts = None
actual = email.get_email_from_shortcut(addr)
self.assertEqual(addr, actual)
CONF.email_plugin.email_shortcuts = ["wb=something@something.com"]
email.shortcuts_dict = None
short = "wb"
actual = email.get_email_from_shortcut(short)
self.assertEqual(email_address, actual)