| 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 import NotifyType |
| 35 |
from apprise.plugins.kodi import NotifyXBMC |
| 36 |
|
| 37 |
logging.disable(logging.CRITICAL) |
| 38 |
|
| 39 |
|
| 40 |
apprise_url_tests = ( |
| 41 |
( |
| 42 |
"kodi://", |
| 43 |
{ |
| 44 |
"instance": None, |
| 45 |
}, |
| 46 |
), |
| 47 |
( |
| 48 |
"kodis://", |
| 49 |
{ |
| 50 |
"instance": None, |
| 51 |
}, |
| 52 |
), |
| 53 |
( |
| 54 |
"kodi://localhost", |
| 55 |
{ |
| 56 |
"instance": NotifyXBMC, |
| 57 |
}, |
| 58 |
), |
| 59 |
( |
| 60 |
"kodi://192.168.4.1", |
| 61 |
{ |
| 62 |
|
| 63 |
"instance": NotifyXBMC, |
| 64 |
}, |
| 65 |
), |
| 66 |
( |
| 67 |
"kodi://[2001:db8:002a:3256:adfe:05c0:0003:0006]", |
| 68 |
{ |
| 69 |
|
| 70 |
"instance": NotifyXBMC, |
| 71 |
|
| 72 |
"privacy_url": "kodi://[2001:db8:002a:3256:adfe:05c0:0003:0006]", |
| 73 |
}, |
| 74 |
), |
| 75 |
( |
| 76 |
"kodi://[2001:db8:002a:3256:adfe:05c0:0003:0006]:8282", |
| 77 |
{ |
| 78 |
|
| 79 |
"instance": NotifyXBMC, |
| 80 |
|
| 81 |
"privacy_url": ( |
| 82 |
"kodi://[2001:db8:002a:3256:adfe:05c0:0003:0006]:8282" |
| 83 |
), |
| 84 |
}, |
| 85 |
), |
| 86 |
( |
| 87 |
"kodi://user:pass@localhost", |
| 88 |
{ |
| 89 |
"instance": NotifyXBMC, |
| 90 |
|
| 91 |
"privacy_url": "kodi://user:****@localhost", |
| 92 |
}, |
| 93 |
), |
| 94 |
( |
| 95 |
"kodi://localhost:8080", |
| 96 |
{ |
| 97 |
"instance": NotifyXBMC, |
| 98 |
}, |
| 99 |
), |
| 100 |
( |
| 101 |
"kodi://user:pass@localhost:8080", |
| 102 |
{ |
| 103 |
"instance": NotifyXBMC, |
| 104 |
}, |
| 105 |
), |
| 106 |
( |
| 107 |
"kodis://localhost", |
| 108 |
{ |
| 109 |
"instance": NotifyXBMC, |
| 110 |
}, |
| 111 |
), |
| 112 |
( |
| 113 |
"kodis://user:pass@localhost", |
| 114 |
{ |
| 115 |
"instance": NotifyXBMC, |
| 116 |
}, |
| 117 |
), |
| 118 |
( |
| 119 |
"kodis://localhost:8080/path/", |
| 120 |
{ |
| 121 |
"instance": NotifyXBMC, |
| 122 |
}, |
| 123 |
), |
| 124 |
( |
| 125 |
"kodis://user:password@localhost:8080", |
| 126 |
{ |
| 127 |
"instance": NotifyXBMC, |
| 128 |
|
| 129 |
"privacy_url": "kodis://user:****@localhost:8080", |
| 130 |
}, |
| 131 |
), |
| 132 |
( |
| 133 |
"kodi://localhost", |
| 134 |
{ |
| 135 |
"instance": NotifyXBMC, |
| 136 |
|
| 137 |
"notify_type": NotifyType.WARNING, |
| 138 |
}, |
| 139 |
), |
| 140 |
( |
| 141 |
"kodi://localhost", |
| 142 |
{ |
| 143 |
"instance": NotifyXBMC, |
| 144 |
|
| 145 |
"notify_type": NotifyType.FAILURE, |
| 146 |
}, |
| 147 |
), |
| 148 |
( |
| 149 |
"kodis://localhost:443", |
| 150 |
{ |
| 151 |
"instance": NotifyXBMC, |
| 152 |
|
| 153 |
"include_image": False, |
| 154 |
}, |
| 155 |
), |
| 156 |
( |
| 157 |
"kodi://:@/", |
| 158 |
{ |
| 159 |
"instance": None, |
| 160 |
}, |
| 161 |
), |
| 162 |
( |
| 163 |
"kodi://user:pass@localhost:8081", |
| 164 |
{ |
| 165 |
"instance": NotifyXBMC, |
| 166 |
|
| 167 |
"response": False, |
| 168 |
"requests_response_code": requests.codes.internal_server_error, |
| 169 |
}, |
| 170 |
), |
| 171 |
( |
| 172 |
"kodi://user:pass@localhost:8082", |
| 173 |
{ |
| 174 |
"instance": NotifyXBMC, |
| 175 |
|
| 176 |
"response": False, |
| 177 |
"requests_response_code": 999, |
| 178 |
}, |
| 179 |
), |
| 180 |
( |
| 181 |
"kodi://user:pass@localhost:8083", |
| 182 |
{ |
| 183 |
"instance": NotifyXBMC, |
| 184 |
|
| 185 |
|
| 186 |
"test_requests_exceptions": True, |
| 187 |
}, |
| 188 |
), |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
( |
| 193 |
"xbmc://", |
| 194 |
{ |
| 195 |
"instance": None, |
| 196 |
}, |
| 197 |
), |
| 198 |
( |
| 199 |
"xbmc://localhost", |
| 200 |
{ |
| 201 |
"instance": NotifyXBMC, |
| 202 |
}, |
| 203 |
), |
| 204 |
( |
| 205 |
"xbmc://localhost?duration=14", |
| 206 |
{ |
| 207 |
"instance": NotifyXBMC, |
| 208 |
}, |
| 209 |
), |
| 210 |
( |
| 211 |
"xbmc://localhost?duration=invalid", |
| 212 |
{ |
| 213 |
"instance": NotifyXBMC, |
| 214 |
}, |
| 215 |
), |
| 216 |
( |
| 217 |
"xbmc://localhost?duration=-1", |
| 218 |
{ |
| 219 |
"instance": NotifyXBMC, |
| 220 |
}, |
| 221 |
), |
| 222 |
( |
| 223 |
"xbmc://user:pass@localhost", |
| 224 |
{ |
| 225 |
"instance": NotifyXBMC, |
| 226 |
}, |
| 227 |
), |
| 228 |
( |
| 229 |
"xbmc://localhost:8080", |
| 230 |
{ |
| 231 |
"instance": NotifyXBMC, |
| 232 |
}, |
| 233 |
), |
| 234 |
( |
| 235 |
"xbmc://user:pass@localhost:8080", |
| 236 |
{ |
| 237 |
"instance": NotifyXBMC, |
| 238 |
}, |
| 239 |
), |
| 240 |
( |
| 241 |
"xbmc://user@localhost", |
| 242 |
{ |
| 243 |
"instance": NotifyXBMC, |
| 244 |
|
| 245 |
"include_image": False, |
| 246 |
}, |
| 247 |
), |
| 248 |
( |
| 249 |
"xbmc://localhost", |
| 250 |
{ |
| 251 |
"instance": NotifyXBMC, |
| 252 |
|
| 253 |
"notify_type": NotifyType.WARNING, |
| 254 |
}, |
| 255 |
), |
| 256 |
( |
| 257 |
"xbmc://localhost", |
| 258 |
{ |
| 259 |
"instance": NotifyXBMC, |
| 260 |
|
| 261 |
"notify_type": NotifyType.FAILURE, |
| 262 |
}, |
| 263 |
), |
| 264 |
( |
| 265 |
"xbmc://:@/", |
| 266 |
{ |
| 267 |
"instance": None, |
| 268 |
}, |
| 269 |
), |
| 270 |
( |
| 271 |
"xbmc://user:pass@localhost:8081", |
| 272 |
{ |
| 273 |
"instance": NotifyXBMC, |
| 274 |
|
| 275 |
"response": False, |
| 276 |
"requests_response_code": requests.codes.internal_server_error, |
| 277 |
}, |
| 278 |
), |
| 279 |
( |
| 280 |
"xbmc://user:pass@localhost:8082", |
| 281 |
{ |
| 282 |
"instance": NotifyXBMC, |
| 283 |
|
| 284 |
"response": False, |
| 285 |
"requests_response_code": 999, |
| 286 |
}, |
| 287 |
), |
| 288 |
( |
| 289 |
"xbmc://user:pass@localhost:8083", |
| 290 |
{ |
| 291 |
"instance": NotifyXBMC, |
| 292 |
|
| 293 |
|
| 294 |
"test_requests_exceptions": True, |
| 295 |
}, |
| 296 |
), |
| 297 |
) |
| 298 |
|
| 299 |
|
| 300 |
def test_plugin_xbmc_kodi_urls(): |
| 301 |
"""NotifyXBMC() Apprise URLs.""" |
| 302 |
|
| 303 |
|
| 304 |
AppriseURLTester(tests=apprise_url_tests).run_all() |