| 1 |
|
| 2 |
import logging |
| 3 |
|
| 4 |
from helpers import AppriseURLTester |
| 5 |
import requests |
| 6 |
|
| 7 |
from apprise.plugins.lark import NotifyLark |
| 8 |
|
| 9 |
logging.disable(logging.CRITICAL) |
| 10 |
|
| 11 |
|
| 12 |
apprise_url_tests = ( |
| 13 |
( |
| 14 |
"lark://", |
| 15 |
{ |
| 16 |
|
| 17 |
"instance": TypeError, |
| 18 |
}, |
| 19 |
), |
| 20 |
( |
| 21 |
"lark://:@/", |
| 22 |
{ |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
"instance": TypeError, |
| 27 |
}, |
| 28 |
), |
| 29 |
( |
| 30 |
"lark://{}".format("abcd-1234"), |
| 31 |
{ |
| 32 |
|
| 33 |
"instance": NotifyLark, |
| 34 |
|
| 35 |
"privacy_url": "lark://****/", |
| 36 |
}, |
| 37 |
), |
| 38 |
( |
| 39 |
"lark://{}".format("abcd-1234"), |
| 40 |
{ |
| 41 |
|
| 42 |
"instance": NotifyLark, |
| 43 |
|
| 44 |
"privacy_url": "lark://****/", |
| 45 |
}, |
| 46 |
), |
| 47 |
( |
| 48 |
"lark://?token={}".format("abcd-1234"), |
| 49 |
{ |
| 50 |
|
| 51 |
"instance": NotifyLark, |
| 52 |
|
| 53 |
"privacy_url": "lark://****/", |
| 54 |
}, |
| 55 |
), |
| 56 |
|
| 57 |
( |
| 58 |
"https://open.larksuite.com/open-apis/bot/v2/hook/{}".format( |
| 59 |
"abcd-1234" |
| 60 |
), |
| 61 |
{ |
| 62 |
|
| 63 |
"instance": NotifyLark, |
| 64 |
}, |
| 65 |
), |
| 66 |
( |
| 67 |
"lark://{}".format("abcd-1234"), |
| 68 |
{ |
| 69 |
"instance": NotifyLark, |
| 70 |
|
| 71 |
"response": False, |
| 72 |
"requests_response_code": requests.codes.internal_server_error, |
| 73 |
}, |
| 74 |
), |
| 75 |
( |
| 76 |
"lark://{}".format("abcd-1234"), |
| 77 |
{ |
| 78 |
"instance": NotifyLark, |
| 79 |
|
| 80 |
"response": False, |
| 81 |
"requests_response_code": 999, |
| 82 |
}, |
| 83 |
), |
| 84 |
( |
| 85 |
"lark://{}".format("a" * 80), |
| 86 |
{ |
| 87 |
"instance": NotifyLark, |
| 88 |
|
| 89 |
|
| 90 |
"test_requests_exceptions": True, |
| 91 |
}, |
| 92 |
), |
| 93 |
) |
| 94 |
|
| 95 |
|
| 96 |
def test_plugin_lark_urls(): |
| 97 |
"""NotifyLark() Apprise URLs.""" |
| 98 |
|
| 99 |
|
| 100 |
AppriseURLTester(tests=apprise_url_tests).run_all() |