| 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.notica import NotifyNotica |
| 35 |
|
| 36 |
logging.disable(logging.CRITICAL) |
| 37 |
|
| 38 |
|
| 39 |
apprise_url_tests = ( |
| 40 |
( |
| 41 |
"notica://", |
| 42 |
{ |
| 43 |
"instance": TypeError, |
| 44 |
}, |
| 45 |
), |
| 46 |
( |
| 47 |
"notica://:@/", |
| 48 |
{ |
| 49 |
"instance": TypeError, |
| 50 |
}, |
| 51 |
), |
| 52 |
|
| 53 |
( |
| 54 |
"https://notica.us/?%s" % ("z" * 6), |
| 55 |
{ |
| 56 |
"instance": NotifyNotica, |
| 57 |
|
| 58 |
"privacy_url": "notica://z...z/", |
| 59 |
}, |
| 60 |
), |
| 61 |
|
| 62 |
( |
| 63 |
"https://notica.us/?%s&overflow=upstream" % ("z" * 6), |
| 64 |
{ |
| 65 |
"instance": NotifyNotica, |
| 66 |
|
| 67 |
"privacy_url": "notica://z...z/", |
| 68 |
}, |
| 69 |
), |
| 70 |
|
| 71 |
( |
| 72 |
"notica://%s" % ("a" * 6), |
| 73 |
{ |
| 74 |
"instance": NotifyNotica, |
| 75 |
|
| 76 |
"privacy_url": "notica://a...a/", |
| 77 |
}, |
| 78 |
), |
| 79 |
|
| 80 |
( |
| 81 |
"notica://localhost/%s" % ("b" * 6), |
| 82 |
{ |
| 83 |
"instance": NotifyNotica, |
| 84 |
}, |
| 85 |
), |
| 86 |
( |
| 87 |
"notica://user@localhost/%s" % ("c" * 6), |
| 88 |
{ |
| 89 |
"instance": NotifyNotica, |
| 90 |
}, |
| 91 |
), |
| 92 |
( |
| 93 |
"notica://user:pass@localhost/%s/" % ("d" * 6), |
| 94 |
{ |
| 95 |
"instance": NotifyNotica, |
| 96 |
|
| 97 |
"privacy_url": "notica://user:****@localhost/d...d", |
| 98 |
}, |
| 99 |
), |
| 100 |
( |
| 101 |
"notica://user:pass@localhost/a/path/%s/" % ("r" * 6), |
| 102 |
{ |
| 103 |
"instance": NotifyNotica, |
| 104 |
|
| 105 |
"privacy_url": "notica://user:****@localhost/a/path/r...r", |
| 106 |
}, |
| 107 |
), |
| 108 |
( |
| 109 |
"notica://localhost:8080/%s" % ("a" * 6), |
| 110 |
{ |
| 111 |
"instance": NotifyNotica, |
| 112 |
}, |
| 113 |
), |
| 114 |
( |
| 115 |
"notica://user:pass@localhost:8080/%s" % ("b" * 6), |
| 116 |
{ |
| 117 |
"instance": NotifyNotica, |
| 118 |
}, |
| 119 |
), |
| 120 |
( |
| 121 |
"noticas://localhost/%s" % ("j" * 6), |
| 122 |
{ |
| 123 |
"instance": NotifyNotica, |
| 124 |
"privacy_url": "noticas://localhost/j...j", |
| 125 |
}, |
| 126 |
), |
| 127 |
( |
| 128 |
"noticas://user:pass@localhost/%s" % ("e" * 6), |
| 129 |
{ |
| 130 |
"instance": NotifyNotica, |
| 131 |
|
| 132 |
"privacy_url": "noticas://user:****@localhost/e...e", |
| 133 |
}, |
| 134 |
), |
| 135 |
( |
| 136 |
"noticas://localhost:8080/path/%s" % ("5" * 6), |
| 137 |
{ |
| 138 |
"instance": NotifyNotica, |
| 139 |
"privacy_url": "noticas://localhost:8080/path/5...5", |
| 140 |
}, |
| 141 |
), |
| 142 |
( |
| 143 |
"noticas://user:pass@localhost:8080/%s" % ("6" * 6), |
| 144 |
{ |
| 145 |
"instance": NotifyNotica, |
| 146 |
}, |
| 147 |
), |
| 148 |
( |
| 149 |
"notica://%s" % ("b" * 6), |
| 150 |
{ |
| 151 |
"instance": NotifyNotica, |
| 152 |
|
| 153 |
"include_image": False, |
| 154 |
}, |
| 155 |
), |
| 156 |
|
| 157 |
( |
| 158 |
"notica://localhost:8080//%s/?+HeaderKey=HeaderValue" % ("7" * 6), |
| 159 |
{ |
| 160 |
"instance": NotifyNotica, |
| 161 |
}, |
| 162 |
), |
| 163 |
( |
| 164 |
"notica://%s" % ("c" * 6), |
| 165 |
{ |
| 166 |
"instance": NotifyNotica, |
| 167 |
|
| 168 |
"response": False, |
| 169 |
"requests_response_code": requests.codes.internal_server_error, |
| 170 |
}, |
| 171 |
), |
| 172 |
( |
| 173 |
"notica://%s" % ("d" * 7), |
| 174 |
{ |
| 175 |
"instance": NotifyNotica, |
| 176 |
|
| 177 |
"response": False, |
| 178 |
"requests_response_code": 999, |
| 179 |
}, |
| 180 |
), |
| 181 |
( |
| 182 |
"notica://%s" % ("e" * 8), |
| 183 |
{ |
| 184 |
"instance": NotifyNotica, |
| 185 |
|
| 186 |
|
| 187 |
"test_requests_exceptions": True, |
| 188 |
}, |
| 189 |
), |
| 190 |
) |
| 191 |
|
| 192 |
|
| 193 |
def test_plugin_notica_urls(): |
| 194 |
"""NotifyNotica() Apprise URLs.""" |
| 195 |
|
| 196 |
|
| 197 |
AppriseURLTester(tests=apprise_url_tests).run_all() |