mirror of
https://github.com/caronc/apprise.git
synced 2024-11-25 09:33:50 +01:00
Improve module vs. class imports re. NotifyBase
and friends (#771)
This commit is contained in:
parent
3389a3d4c3
commit
eb85dca076
@ -31,10 +31,7 @@ from os.path import dirname
|
|||||||
from os.path import abspath
|
from os.path import abspath
|
||||||
|
|
||||||
# Used for testing
|
# Used for testing
|
||||||
from . import NotifyEmail as NotifyEmailBase
|
from .NotifyBase import NotifyBase
|
||||||
|
|
||||||
# NotifyBase object is passed in as a module not class
|
|
||||||
from . import NotifyBase
|
|
||||||
|
|
||||||
from ..common import NotifyImageSize
|
from ..common import NotifyImageSize
|
||||||
from ..common import NOTIFY_IMAGE_SIZES
|
from ..common import NOTIFY_IMAGE_SIZES
|
||||||
@ -53,9 +50,6 @@ __all__ = [
|
|||||||
'NotifyImageSize', 'NOTIFY_IMAGE_SIZES', 'NotifyType', 'NOTIFY_TYPES',
|
'NotifyImageSize', 'NOTIFY_IMAGE_SIZES', 'NotifyType', 'NOTIFY_TYPES',
|
||||||
'NotifyBase',
|
'NotifyBase',
|
||||||
|
|
||||||
# NotifyEmail Base Module (used for NotifyEmail testing)
|
|
||||||
'NotifyEmailBase',
|
|
||||||
|
|
||||||
# Tokenizer
|
# Tokenizer
|
||||||
'url_to_dict',
|
'url_to_dict',
|
||||||
]
|
]
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
@ -34,15 +35,13 @@ from apprise import NotifyType, NotifyBase
|
|||||||
from apprise import Apprise
|
from apprise import Apprise
|
||||||
from apprise import AttachBase
|
from apprise import AttachBase
|
||||||
from apprise import AppriseAttachment
|
from apprise import AppriseAttachment
|
||||||
from apprise.plugins import NotifyEmailBase
|
from apprise.plugins.NotifyEmail import NotifyEmail
|
||||||
|
from apprise.plugins import NotifyEmail as NotifyEmailModule
|
||||||
|
|
||||||
# Disable logging for a cleaner testing output
|
# Disable logging for a cleaner testing output
|
||||||
import logging
|
|
||||||
|
|
||||||
from apprise.plugins.NotifyEmail import NotifyEmail
|
|
||||||
|
|
||||||
logging.disable(logging.CRITICAL)
|
logging.disable(logging.CRITICAL)
|
||||||
|
|
||||||
|
|
||||||
# Attachment Directory
|
# Attachment Directory
|
||||||
TEST_VAR_DIR = os.path.join(os.path.dirname(__file__), 'var')
|
TEST_VAR_DIR = os.path.join(os.path.dirname(__file__), 'var')
|
||||||
|
|
||||||
@ -420,7 +419,7 @@ def test_plugin_email_webbase_lookup(mock_smtp, mock_smtpssl):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Insert a test email at the head of our table
|
# Insert a test email at the head of our table
|
||||||
NotifyEmailBase.EMAIL_TEMPLATES = (
|
NotifyEmailModule.EMAIL_TEMPLATES = (
|
||||||
(
|
(
|
||||||
# Testing URL
|
# Testing URL
|
||||||
'Testing Lookup',
|
'Testing Lookup',
|
||||||
@ -429,10 +428,10 @@ def test_plugin_email_webbase_lookup(mock_smtp, mock_smtpssl):
|
|||||||
'port': 123,
|
'port': 123,
|
||||||
'smtp_host': 'smtp.l2g.com',
|
'smtp_host': 'smtp.l2g.com',
|
||||||
'secure': True,
|
'secure': True,
|
||||||
'login_type': (NotifyEmailBase.WebBaseLogin.USERID, )
|
'login_type': (NotifyEmailModule.WebBaseLogin.USERID, )
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
) + NotifyEmailBase.EMAIL_TEMPLATES
|
) + NotifyEmailModule.EMAIL_TEMPLATES
|
||||||
|
|
||||||
obj = Apprise.instantiate(
|
obj = Apprise.instantiate(
|
||||||
'mailto://user:pass@l2g.com', suppress_exceptions=True)
|
'mailto://user:pass@l2g.com', suppress_exceptions=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user