Resolve ambiguity with apprise.plugins module namespace

While the namespace is physically made of modules, it has been amended
to be the namespace home for the corresponding notifier classes as well.

This turned out to confuse both humans and machines on various ends.

While it has apparently worked for a while, it croaks on Python 3.11
now, and is not considered to have been a good idea in general.
This commit is contained in:
Andreas Motl
2022-10-09 11:28:18 +02:00
parent c797d1e2eb
commit c9f0751b61
88 changed files with 1721 additions and 1688 deletions

View File

@ -27,7 +27,7 @@ from unittest import mock
import requests
from json import loads
from apprise import Apprise
from apprise import plugins
from apprise.plugins.NotifyBulkSMS import NotifyBulkSMS
from helpers import AppriseURLTester
from apprise import NotifyType
@ -39,53 +39,53 @@ logging.disable(logging.CRITICAL)
apprise_url_tests = (
('bulksms://', {
# Instantiated but no auth, so no otification can happen
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# Expected notify() response because we have no one to notify
'notify_response': False,
}),
('bulksms://:@/', {
# invalid auth
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# Expected notify() response because we have no one to notify
'notify_response': False,
}),
('bulksms://{}@12345678'.format('a' * 10), {
# Just user provided (no password)
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# Expected notify() response because we have no one to notify
'notify_response': False,
}),
('bulksms://{}:{}@{}'.format('a' * 10, 'b' * 10, '3' * 5), {
# invalid nubmer provided
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# Expected notify() response because we have no one to notify
'notify_response': False,
}),
('bulksms://{}:{}@123/{}/abcd/'.format(
'a' * 5, 'b' * 10, '3' * 11), {
# included group and phone, short number (123) dropped
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
'privacy_url': 'bulksms://a...a:****@+33333333333/@abcd'
}),
('bulksms://{}:{}@{}?batch=y&unicode=n'.format(
'b' * 5, 'c' * 10, '4' * 11), {
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# Our expected url(privacy=True) startswith() response:
'privacy_url': 'bulksms://b...b:****@+4444444444',
}),
('bulksms://{}:{}@123456/{}'.format('a' * 10, 'b' * 10, '4' * 11), {
# using short-code (6 characters)
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
}),
('bulksms://{}:{}@{}'.format('a' * 10, 'b' * 10, '5' * 11), {
# using phone no with no target - we text ourselves in
# this case
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
}),
# Test route group
('bulksms://{}:{}@admin?route=premium'.format('a' * 10, 'b' * 10), {
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
}),
('bulksms://{}:{}@admin?route=invalid'.format('a' * 10, 'b' * 10), {
# invalid route
@ -94,7 +94,7 @@ apprise_url_tests = (
('bulksms://_?user={}&password={}&from={}'.format(
'a' * 10, 'b' * 10, '5' * 11), {
# use get args to acomplish the same thing
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
}),
('bulksms://_?user={}&password={}&from={}'.format(
'a' * 10, 'b' * 10, '5' * 3), {
@ -104,16 +104,16 @@ apprise_url_tests = (
('bulksms://_?user={}&password={}&from={}&to={}'.format(
'a' * 10, 'b' * 10, '5' * 11, '7' * 13), {
# use to=
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
}),
('bulksms://{}:{}@{}'.format('a' * 10, 'b' * 10, 'a' * 3), {
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# throw a bizzare code forcing us to fail to look it up
'response': False,
'requests_response_code': 999,
}),
('bulksms://{}:{}@{}'.format('a' * 10, 'b' * 10, '6' * 11), {
'instance': plugins.NotifyBulkSMS,
'instance': NotifyBulkSMS,
# Throws a series of connection and transfer exceptions when this flag
# is set and tests that we gracfully handle them
'test_requests_exceptions': True,