| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
import logging |
| 30 |
|
| 31 |
from helpers import AppriseURLTester |
| 32 |
import requests |
| 33 |
|
| 34 |
from apprise.plugins.enigma2 import NotifyEnigma2 |
| 35 |
|
| 36 |
logging.disable(logging.CRITICAL) |
| 37 |
|
| 38 |
|
| 39 |
apprise_url_tests = ( |
| 40 |
( |
| 41 |
"enigma2://:@/", |
| 42 |
{ |
| 43 |
"instance": None, |
| 44 |
}, |
| 45 |
), |
| 46 |
( |
| 47 |
"enigma2://", |
| 48 |
{ |
| 49 |
"instance": None, |
| 50 |
}, |
| 51 |
), |
| 52 |
( |
| 53 |
"enigma2s://", |
| 54 |
{ |
| 55 |
"instance": None, |
| 56 |
}, |
| 57 |
), |
| 58 |
( |
| 59 |
"enigma2://localhost", |
| 60 |
{ |
| 61 |
"instance": NotifyEnigma2, |
| 62 |
|
| 63 |
|
| 64 |
"notify_response": False, |
| 65 |
}, |
| 66 |
), |
| 67 |
( |
| 68 |
"enigma2://localhost", |
| 69 |
{ |
| 70 |
"instance": NotifyEnigma2, |
| 71 |
|
| 72 |
"requests_response_text": "{", |
| 73 |
"notify_response": False, |
| 74 |
}, |
| 75 |
), |
| 76 |
( |
| 77 |
"enigma2://localhost", |
| 78 |
{ |
| 79 |
"instance": NotifyEnigma2, |
| 80 |
|
| 81 |
"requests_response_text": {"result": False}, |
| 82 |
"notify_response": False, |
| 83 |
}, |
| 84 |
), |
| 85 |
( |
| 86 |
"enigma2://localhost", |
| 87 |
{ |
| 88 |
"instance": NotifyEnigma2, |
| 89 |
|
| 90 |
"requests_response_text": {"result": True}, |
| 91 |
}, |
| 92 |
), |
| 93 |
( |
| 94 |
"enigma2://user@localhost", |
| 95 |
{ |
| 96 |
"instance": NotifyEnigma2, |
| 97 |
"requests_response_text": {"result": True}, |
| 98 |
}, |
| 99 |
), |
| 100 |
|
| 101 |
( |
| 102 |
"enigma2://user@localhost?timeout=-1", |
| 103 |
{ |
| 104 |
"instance": NotifyEnigma2, |
| 105 |
"requests_response_text": {"result": True}, |
| 106 |
}, |
| 107 |
), |
| 108 |
|
| 109 |
( |
| 110 |
"enigma2://user@localhost?timeout=-1000", |
| 111 |
{ |
| 112 |
"instance": NotifyEnigma2, |
| 113 |
"requests_response_text": {"result": True}, |
| 114 |
}, |
| 115 |
), |
| 116 |
|
| 117 |
( |
| 118 |
"enigma2://user@localhost?timeout=invalid", |
| 119 |
{ |
| 120 |
"instance": NotifyEnigma2, |
| 121 |
"requests_response_text": {"result": True}, |
| 122 |
}, |
| 123 |
), |
| 124 |
( |
| 125 |
"enigma2://user:pass@localhost", |
| 126 |
{ |
| 127 |
"instance": NotifyEnigma2, |
| 128 |
"requests_response_text": {"result": True}, |
| 129 |
|
| 130 |
"privacy_url": "enigma2://user:****@localhost", |
| 131 |
}, |
| 132 |
), |
| 133 |
( |
| 134 |
"enigma2://localhost:8080", |
| 135 |
{ |
| 136 |
"instance": NotifyEnigma2, |
| 137 |
"requests_response_text": {"result": True}, |
| 138 |
}, |
| 139 |
), |
| 140 |
( |
| 141 |
"enigma2://user:pass@localhost:8080", |
| 142 |
{ |
| 143 |
"instance": NotifyEnigma2, |
| 144 |
"requests_response_text": {"result": True}, |
| 145 |
}, |
| 146 |
), |
| 147 |
( |
| 148 |
"enigma2s://localhost", |
| 149 |
{ |
| 150 |
"instance": NotifyEnigma2, |
| 151 |
"requests_response_text": {"result": True}, |
| 152 |
}, |
| 153 |
), |
| 154 |
( |
| 155 |
"enigma2s://user:pass@localhost", |
| 156 |
{ |
| 157 |
"instance": NotifyEnigma2, |
| 158 |
"requests_response_text": {"result": True}, |
| 159 |
|
| 160 |
"privacy_url": "enigma2s://user:****@localhost", |
| 161 |
}, |
| 162 |
), |
| 163 |
( |
| 164 |
"enigma2s://localhost:8080/path/", |
| 165 |
{ |
| 166 |
"instance": NotifyEnigma2, |
| 167 |
"requests_response_text": {"result": True}, |
| 168 |
|
| 169 |
"privacy_url": "enigma2s://localhost:8080/path/", |
| 170 |
}, |
| 171 |
), |
| 172 |
( |
| 173 |
"enigma2s://user:pass@localhost:8080", |
| 174 |
{ |
| 175 |
"instance": NotifyEnigma2, |
| 176 |
"requests_response_text": {"result": True}, |
| 177 |
}, |
| 178 |
), |
| 179 |
( |
| 180 |
"enigma2://localhost:8080/path?+HeaderKey=HeaderValue", |
| 181 |
{ |
| 182 |
"instance": NotifyEnigma2, |
| 183 |
"requests_response_text": {"result": True}, |
| 184 |
}, |
| 185 |
), |
| 186 |
( |
| 187 |
"enigma2://user:pass@localhost:8081", |
| 188 |
{ |
| 189 |
"instance": NotifyEnigma2, |
| 190 |
"requests_response_text": {"result": True}, |
| 191 |
|
| 192 |
"response": False, |
| 193 |
"requests_response_code": requests.codes.internal_server_error, |
| 194 |
}, |
| 195 |
), |
| 196 |
( |
| 197 |
"enigma2://user:pass@localhost:8082", |
| 198 |
{ |
| 199 |
"instance": NotifyEnigma2, |
| 200 |
"requests_response_text": {"result": True}, |
| 201 |
|
| 202 |
"response": False, |
| 203 |
"requests_response_code": 999, |
| 204 |
}, |
| 205 |
), |
| 206 |
( |
| 207 |
"enigma2://user:pass@localhost:8083", |
| 208 |
{ |
| 209 |
"instance": NotifyEnigma2, |
| 210 |
"requests_response_text": {"result": True}, |
| 211 |
|
| 212 |
|
| 213 |
"test_requests_exceptions": True, |
| 214 |
}, |
| 215 |
), |
| 216 |
) |
| 217 |
|
| 218 |
|
| 219 |
def test_plugin_enigma2_urls(): |
| 220 |
"""NotifyEnigma2() Apprise URLs.""" |
| 221 |
|
| 222 |
|
| 223 |
AppriseURLTester(tests=apprise_url_tests).run_all() |