mirror of
https://github.com/caronc/apprise.git
synced 2025-08-09 16:35:07 +02:00
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:
@ -23,8 +23,9 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
import pytest
|
||||
from apprise import plugins
|
||||
import requests
|
||||
|
||||
from apprise.plugins.NotifyZulip import NotifyZulip
|
||||
from helpers import AppriseURLTester
|
||||
|
||||
# Disable logging for a cleaner testing output
|
||||
@ -57,52 +58,52 @@ apprise_url_tests = (
|
||||
}),
|
||||
# Valid everything - botname with a dash
|
||||
('zulip://bot-name@apprise/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
'privacy_url': 'zulip://bot-name@apprise/a...a/',
|
||||
}),
|
||||
# Valid everything - no target so default is used
|
||||
('zulip://botname@apprise/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
|
||||
# Our expected url(privacy=True) startswith() response:
|
||||
'privacy_url': 'zulip://botname@apprise/a...a/',
|
||||
}),
|
||||
# Valid everything - organization as hostname
|
||||
('zulip://botname@apprise.zulipchat.com/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
}),
|
||||
# Valid everything - 2 streams specified
|
||||
('zulip://botname@apprise/{}/channel1/channel2'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
}),
|
||||
# Valid everything - 2 streams specified (using to=)
|
||||
('zulip://botname@apprise/{}/?to=channel1/channel2'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
}),
|
||||
# Valid everything - 2 emails specified
|
||||
('zulip://botname@apprise/{}/user@example.com/user2@example.com'.format(
|
||||
'a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
}),
|
||||
('zulip://botname@apprise/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
# don't include an image by default
|
||||
'include_image': False,
|
||||
}),
|
||||
('zulip://botname@apprise/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
# force a failure
|
||||
'response': False,
|
||||
'requests_response_code': requests.codes.internal_server_error,
|
||||
}),
|
||||
('zulip://botname@apprise/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
# throw a bizzare code forcing us to fail to look it up
|
||||
'response': False,
|
||||
'requests_response_code': 999,
|
||||
}),
|
||||
('zulip://botname@apprise/{}'.format('a' * 32), {
|
||||
'instance': plugins.NotifyZulip,
|
||||
'instance': NotifyZulip,
|
||||
# Throws a series of connection and transfer exceptions when this flag
|
||||
# is set and tests that we gracfully handle them
|
||||
'test_requests_exceptions': True,
|
||||
@ -131,5 +132,5 @@ def test_plugin_zulip_edge_cases(no_throttling):
|
||||
|
||||
# Invalid organization
|
||||
with pytest.raises(TypeError):
|
||||
plugins.NotifyZulip(
|
||||
NotifyZulip(
|
||||
botname='test', organization='#', token=token)
|
||||
|
Reference in New Issue
Block a user