Debian Codegraph @

tests/test_plugin_spugpush.py

raw symbols SCIP
1 #
2 # BSD 2-Clause License
3 #
4 # Apprise - Push Notification Library.
5 # Copyright (c) 2026, Chris Caron <[email protected]>
6 #
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are met:
9 #
10 # 1. Redistributions of source code must retain the above copyright notice,
11 # this list of conditions and the following disclaimer.
12 #
13 # 2. Redistributions in binary form must reproduce the above copyright notice,
14 # this list of conditions and the following disclaimer in the documentation
15 # and/or other materials provided with the distribution.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
28
29 import logging
30
31 from helpers import AppriseURLTester
32 import requests
33
34 from apprise.plugins.spugpush import NotifySpugpush
35
36 logging.disable(logging.CRITICAL)
37
38 apprise_url_tests = (
39 (
40 "spugpush://",
41 {
42 "instance": TypeError,
43 },
44 ),
45 (
46 "spugpush://invalid!",
47 {
48 "instance": TypeError,
49 },
50 ),
51 (
52 "spugpush://abc123def456ghi789jkl012mno345pq",
53 {
54 "instance": NotifySpugpush,
55 "privacy_url": "spugpush://****/",
56 },
57 ),
58 (
59 "spugpush://?token=abc123def456ghi789jkl012mno345pq",
60 {
61 "instance": NotifySpugpush,
62 "privacy_url": "spugpush://****/",
63 },
64 ),
65 (
66 "https://push.spug.dev/send/abc123def456ghi789jkl012mno345pq",
67 {
68 "instance": NotifySpugpush,
69 },
70 ),
71 (
72 "spugpush://abc123def456ghi789jkl012mno345pq",
73 {
74 "instance": NotifySpugpush,
75 "response": False,
76 "requests_response_code": requests.codes.internal_server_error,
77 },
78 ),
79 (
80 "spugpush://abc123def456ghi789jkl012mno345pq",
81 {
82 "instance": NotifySpugpush,
83 "response": False,
84 "requests_response_code": 999,
85 },
86 ),
87 (
88 "spugpush://ffffffffffffffffffffffffffffffff",
89 {
90 "instance": NotifySpugpush,
91 "test_requests_exceptions": True,
92 },
93 ),
94 )
95
96
97 def test_plugin_spugpush_urls():
98 AppriseURLTester(tests=apprise_url_tests).run_all()