| 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 |
|
| 33 |
from apprise.plugins.plivo import NotifyPlivo |
| 34 |
|
| 35 |
logging.disable(logging.CRITICAL) |
| 36 |
|
| 37 |
|
| 38 |
apprise_url_tests = ( |
| 39 |
( |
| 40 |
"plivo://", |
| 41 |
{ |
| 42 |
|
| 43 |
"instance": TypeError, |
| 44 |
}, |
| 45 |
), |
| 46 |
( |
| 47 |
"plivo://{}@{}/15551232000".format("a" * 10, "a" * 25), |
| 48 |
{ |
| 49 |
|
| 50 |
"instance": TypeError, |
| 51 |
}, |
| 52 |
), |
| 53 |
( |
| 54 |
"plivo://{}@{}/15551232000".format("a" * 25, "a" * 10), |
| 55 |
{ |
| 56 |
|
| 57 |
"instance": TypeError, |
| 58 |
}, |
| 59 |
), |
| 60 |
( |
| 61 |
"plivo://{}@{}/123".format("a" * 25, "a" * 40), |
| 62 |
{ |
| 63 |
|
| 64 |
"instance": TypeError, |
| 65 |
}, |
| 66 |
), |
| 67 |
( |
| 68 |
"plivo://{}@{}/abc".format("a" * 25, "a" * 40), |
| 69 |
{ |
| 70 |
|
| 71 |
"instance": TypeError, |
| 72 |
}, |
| 73 |
), |
| 74 |
( |
| 75 |
"plivo://{}@{}/15551231234".format("a" * 25, "b" * 40), |
| 76 |
{ |
| 77 |
|
| 78 |
"instance": NotifyPlivo, |
| 79 |
}, |
| 80 |
), |
| 81 |
( |
| 82 |
"plivo://{}@{}/15551232000/abcd".format("a" * 25, "a" * 40), |
| 83 |
{ |
| 84 |
|
| 85 |
"instance": NotifyPlivo, |
| 86 |
|
| 87 |
"response": False, |
| 88 |
}, |
| 89 |
), |
| 90 |
( |
| 91 |
"plivo://{}@{}/15551232000/123".format("a" * 25, "a" * 40), |
| 92 |
{ |
| 93 |
|
| 94 |
"instance": NotifyPlivo, |
| 95 |
|
| 96 |
"response": False, |
| 97 |
}, |
| 98 |
), |
| 99 |
( |
| 100 |
"plivo://{}@{}/?from=15551233000&to=15551232000&batch=yes".format( |
| 101 |
"a" * 25, "a" * 40 |
| 102 |
), |
| 103 |
{ |
| 104 |
|
| 105 |
"instance": NotifyPlivo, |
| 106 |
}, |
| 107 |
), |
| 108 |
( |
| 109 |
"plivo://?id={}&token={}&from=15551233000&to=15551232000".format( |
| 110 |
"a" * 25, "a" * 40 |
| 111 |
), |
| 112 |
{ |
| 113 |
|
| 114 |
"privacy_url": "plivo://[email protected]/+15551233000/+15551232000", |
| 115 |
|
| 116 |
"instance": NotifyPlivo, |
| 117 |
}, |
| 118 |
), |
| 119 |
( |
| 120 |
"plivo://15551232123?id={}&token={}&from=15551233000" |
| 121 |
"&to=15551232000".format("a" * 25, "a" * 40), |
| 122 |
{ |
| 123 |
|
| 124 |
"instance": NotifyPlivo, |
| 125 |
|
| 126 |
"privacy_url": "plivo://[email protected]/+15551233000/+15551232123", |
| 127 |
}, |
| 128 |
), |
| 129 |
( |
| 130 |
"plivo://{}@{}/15551232000".format("a" * 25, "a" * 40), |
| 131 |
{ |
| 132 |
"instance": NotifyPlivo, |
| 133 |
|
| 134 |
"response": False, |
| 135 |
"requests_response_code": 999, |
| 136 |
}, |
| 137 |
), |
| 138 |
( |
| 139 |
"plivo://{}@{}/15551232000".format("a" * 25, "a" * 40), |
| 140 |
{ |
| 141 |
"instance": NotifyPlivo, |
| 142 |
|
| 143 |
|
| 144 |
"test_requests_exceptions": True, |
| 145 |
}, |
| 146 |
), |
| 147 |
) |
| 148 |
|
| 149 |
|
| 150 |
def test_plugin_plivo_urls(): |
| 151 |
"""NotifyPlivo() Apprise URLs.""" |
| 152 |
|
| 153 |
|
| 154 |
AppriseURLTester(tests=apprise_url_tests).run_all() |