| 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 |
from json import dumps |
| 29 |
|
| 30 |
|
| 31 |
import logging |
| 32 |
|
| 33 |
from helpers import AppriseURLTester |
| 34 |
|
| 35 |
from apprise.plugins.signl4 import ( |
| 36 |
NotifySIGNL4, |
| 37 |
NotifyType, |
| 38 |
) |
| 39 |
|
| 40 |
logging.disable(logging.CRITICAL) |
| 41 |
|
| 42 |
SIGNL4_GOOD_RESPONSE = dumps( |
| 43 |
{ |
| 44 |
"eventId": "2516485120936941747_76d5cf30-27d2-4529-84ed-f31a8f2c72b1", |
| 45 |
} |
| 46 |
) |
| 47 |
|
| 48 |
|
| 49 |
apprise_url_tests = ( |
| 50 |
( |
| 51 |
"signl4://", |
| 52 |
{ |
| 53 |
|
| 54 |
"instance": TypeError, |
| 55 |
}, |
| 56 |
), |
| 57 |
( |
| 58 |
"signl4://:@/", |
| 59 |
{ |
| 60 |
|
| 61 |
"instance": TypeError, |
| 62 |
}, |
| 63 |
), |
| 64 |
( |
| 65 |
"signl4://%20%20/", |
| 66 |
{ |
| 67 |
|
| 68 |
"instance": TypeError, |
| 69 |
}, |
| 70 |
), |
| 71 |
( |
| 72 |
"signl4://secret/", |
| 73 |
{ |
| 74 |
|
| 75 |
"instance": NotifySIGNL4, |
| 76 |
"notify_type": NotifyType.FAILURE, |
| 77 |
|
| 78 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 79 |
}, |
| 80 |
), |
| 81 |
( |
| 82 |
"signl4://?secret=secret", |
| 83 |
{ |
| 84 |
|
| 85 |
"instance": NotifySIGNL4, |
| 86 |
"notify_type": NotifyType.FAILURE, |
| 87 |
|
| 88 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 89 |
}, |
| 90 |
), |
| 91 |
( |
| 92 |
"signl4://secret/?service=IoT", |
| 93 |
{ |
| 94 |
|
| 95 |
"instance": NotifySIGNL4, |
| 96 |
"notify_type": NotifyType.FAILURE, |
| 97 |
|
| 98 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 99 |
}, |
| 100 |
), |
| 101 |
( |
| 102 |
"signl4://secret/?filtering=yes", |
| 103 |
{ |
| 104 |
|
| 105 |
"instance": NotifySIGNL4, |
| 106 |
"notify_type": NotifyType.FAILURE, |
| 107 |
|
| 108 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 109 |
}, |
| 110 |
), |
| 111 |
( |
| 112 |
"signl4://secret/?location=40.6413111,-73.7781391", |
| 113 |
{ |
| 114 |
|
| 115 |
"instance": NotifySIGNL4, |
| 116 |
"notify_type": NotifyType.FAILURE, |
| 117 |
|
| 118 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 119 |
}, |
| 120 |
), |
| 121 |
( |
| 122 |
"signl4://secret/?alerting_scenario=singl4_ack", |
| 123 |
{ |
| 124 |
|
| 125 |
"instance": NotifySIGNL4, |
| 126 |
"notify_type": NotifyType.FAILURE, |
| 127 |
|
| 128 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 129 |
}, |
| 130 |
), |
| 131 |
( |
| 132 |
"signl4://secret/?filtering=False", |
| 133 |
{ |
| 134 |
|
| 135 |
"instance": NotifySIGNL4, |
| 136 |
"notify_type": NotifyType.FAILURE, |
| 137 |
|
| 138 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 139 |
}, |
| 140 |
), |
| 141 |
( |
| 142 |
"signl4://secret/?external_id=ar1234&status=new", |
| 143 |
{ |
| 144 |
|
| 145 |
"instance": NotifySIGNL4, |
| 146 |
"notify_type": NotifyType.FAILURE, |
| 147 |
|
| 148 |
"requests_response_text": SIGNL4_GOOD_RESPONSE, |
| 149 |
}, |
| 150 |
), |
| 151 |
( |
| 152 |
"signl4://secret/", |
| 153 |
{ |
| 154 |
"instance": NotifySIGNL4, |
| 155 |
|
| 156 |
"response": False, |
| 157 |
"requests_response_code": 999, |
| 158 |
}, |
| 159 |
), |
| 160 |
( |
| 161 |
"signl4://secret/", |
| 162 |
{ |
| 163 |
"instance": NotifySIGNL4, |
| 164 |
|
| 165 |
|
| 166 |
"test_requests_exceptions": True, |
| 167 |
}, |
| 168 |
), |
| 169 |
) |
| 170 |
|
| 171 |
|
| 172 |
def test_plugin_signl4_urls(): |
| 173 |
"""NotifySIGNL4() Apprise URLs.""" |
| 174 |
|
| 175 |
|
| 176 |
AppriseURLTester(tests=apprise_url_tests).run_all() |