2020-12-09 14:13:35 -05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import sys
|
|
|
|
import unittest
|
|
|
|
|
2020-12-17 10:00:47 -05:00
|
|
|
from aprsd import email
|
2020-12-09 14:13:35 -05:00
|
|
|
|
|
|
|
if sys.version_info >= (3, 2):
|
|
|
|
from unittest import mock
|
|
|
|
else:
|
|
|
|
import mock
|
|
|
|
|
|
|
|
|
2021-01-06 17:50:02 -05:00
|
|
|
class TestMain(unittest.TestCase):
|
2020-12-17 10:00:47 -05:00
|
|
|
@mock.patch("aprsd.email._imap_connect")
|
|
|
|
@mock.patch("aprsd.email._smtp_connect")
|
2020-12-09 14:13:35 -05:00
|
|
|
def test_validate_email(self, imap_mock, smtp_mock):
|
|
|
|
"""Test to make sure we fail."""
|
|
|
|
imap_mock.return_value = None
|
|
|
|
smtp_mock.return_value = {"smaiof": "fire"}
|
2020-12-19 16:35:53 -05:00
|
|
|
config = mock.MagicMock()
|
2020-12-09 14:13:35 -05:00
|
|
|
|
2020-12-19 16:35:53 -05:00
|
|
|
email.validate_email_config(config, True)
|