You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

673 lines
23 KiB

6 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
6 years ago
6 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
6 years ago
6 years ago
5 years ago
  1. # coding: utf-8
  2. from datetime import timedelta as td
  3. import json
  4. from django.core import mail
  5. from django.utils.timezone import now
  6. from hc.api.models import Channel, Check, Notification
  7. from hc.test import BaseTestCase
  8. from mock import patch, Mock
  9. from requests.exceptions import ConnectionError, Timeout
  10. from django.test.utils import override_settings
  11. class NotifyTestCase(BaseTestCase):
  12. def _setup_data(self, kind, value, status="down", email_verified=True):
  13. self.check = Check(project=self.project)
  14. self.check.status = status
  15. self.check.last_ping = now() - td(minutes=61)
  16. self.check.save()
  17. self.channel = Channel(project=self.project)
  18. self.channel.kind = kind
  19. self.channel.value = value
  20. self.channel.email_verified = email_verified
  21. self.channel.save()
  22. self.channel.checks.add(self.check)
  23. @patch("hc.api.transports.requests.request")
  24. def test_webhook(self, mock_get):
  25. self._setup_data("webhook", "http://example")
  26. mock_get.return_value.status_code = 200
  27. self.channel.notify(self.check)
  28. mock_get.assert_called_with(
  29. "get",
  30. "http://example",
  31. headers={"User-Agent": "healthchecks.io"},
  32. timeout=5,
  33. )
  34. @patch("hc.api.transports.requests.request", side_effect=Timeout)
  35. def test_webhooks_handle_timeouts(self, mock_get):
  36. self._setup_data("webhook", "http://example")
  37. self.channel.notify(self.check)
  38. n = Notification.objects.get()
  39. self.assertEqual(n.error, "Connection timed out")
  40. @patch("hc.api.transports.requests.request", side_effect=ConnectionError)
  41. def test_webhooks_handle_connection_errors(self, mock_get):
  42. self._setup_data("webhook", "http://example")
  43. self.channel.notify(self.check)
  44. n = Notification.objects.get()
  45. self.assertEqual(n.error, "Connection failed")
  46. @patch("hc.api.transports.requests.request")
  47. def test_webhooks_ignore_up_events(self, mock_get):
  48. self._setup_data("webhook", "http://example", status="up")
  49. self.channel.notify(self.check)
  50. self.assertFalse(mock_get.called)
  51. self.assertEqual(Notification.objects.count(), 0)
  52. @patch("hc.api.transports.requests.request")
  53. def test_webhooks_handle_500(self, mock_get):
  54. self._setup_data("webhook", "http://example")
  55. mock_get.return_value.status_code = 500
  56. self.channel.notify(self.check)
  57. n = Notification.objects.get()
  58. self.assertEqual(n.error, "Received status code 500")
  59. @patch("hc.api.transports.requests.request")
  60. def test_webhooks_support_tags(self, mock_get):
  61. template = "http://host/$TAGS"
  62. self._setup_data("webhook", template)
  63. self.check.tags = "foo bar"
  64. self.check.save()
  65. self.channel.notify(self.check)
  66. args, kwargs = mock_get.call_args
  67. self.assertEqual(args[0], "get")
  68. self.assertEqual(args[1], "http://host/foo%20bar")
  69. @patch("hc.api.transports.requests.request")
  70. def test_webhooks_support_variables(self, mock_get):
  71. template = "http://host/$CODE/$STATUS/$TAG1/$TAG2/?name=$NAME"
  72. self._setup_data("webhook", template)
  73. self.check.name = "Hello World"
  74. self.check.tags = "foo bar"
  75. self.check.save()
  76. self.channel.notify(self.check)
  77. url = "http://host/%s/down/foo/bar/?name=Hello%%20World" % self.check.code
  78. args, kwargs = mock_get.call_args
  79. self.assertEqual(args[0], "get")
  80. self.assertEqual(args[1], url)
  81. self.assertEqual(kwargs["headers"], {"User-Agent": "healthchecks.io"})
  82. self.assertEqual(kwargs["timeout"], 5)
  83. @patch("hc.api.transports.requests.request")
  84. def test_webhooks_support_post(self, mock_request):
  85. template = "http://example.com\n\nThe Time Is $NOW"
  86. self._setup_data("webhook", template)
  87. self.check.save()
  88. self.channel.notify(self.check)
  89. args, kwargs = mock_request.call_args
  90. self.assertEqual(args[0], "post")
  91. self.assertEqual(args[1], "http://example.com")
  92. # spaces should not have been urlencoded:
  93. payload = kwargs["data"].decode()
  94. self.assertTrue(payload.startswith("The Time Is 2"))
  95. @patch("hc.api.transports.requests.request")
  96. def test_webhooks_dollarsign_escaping(self, mock_get):
  97. # If name or tag contains what looks like a variable reference,
  98. # that should be left alone:
  99. template = "http://host/$NAME"
  100. self._setup_data("webhook", template)
  101. self.check.name = "$TAG1"
  102. self.check.tags = "foo"
  103. self.check.save()
  104. self.channel.notify(self.check)
  105. url = "http://host/%24TAG1"
  106. mock_get.assert_called_with(
  107. "get", url, headers={"User-Agent": "healthchecks.io"}, timeout=5
  108. )
  109. @patch("hc.api.transports.requests.request")
  110. def test_webhook_fires_on_up_event(self, mock_get):
  111. self._setup_data("webhook", "http://foo\nhttp://bar", status="up")
  112. self.channel.notify(self.check)
  113. mock_get.assert_called_with(
  114. "get", "http://bar", headers={"User-Agent": "healthchecks.io"}, timeout=5
  115. )
  116. @patch("hc.api.transports.requests.request")
  117. def test_webhooks_handle_unicode_post_body(self, mock_request):
  118. template = "http://example.com\n\n(╯°□°)╯︵ ┻━┻"
  119. self._setup_data("webhook", template)
  120. self.check.save()
  121. self.channel.notify(self.check)
  122. args, kwargs = mock_request.call_args
  123. # unicode should be encoded into utf-8
  124. self.assertIsInstance(kwargs["data"], bytes)
  125. @patch("hc.api.transports.requests.request")
  126. def test_webhooks_handle_json_value(self, mock_request):
  127. definition = {
  128. "method_down": "GET",
  129. "url_down": "http://foo.com",
  130. "body_down": "",
  131. "headers_down": {},
  132. }
  133. self._setup_data("webhook", json.dumps(definition))
  134. self.channel.notify(self.check)
  135. headers = {"User-Agent": "healthchecks.io"}
  136. mock_request.assert_called_with(
  137. "get", "http://foo.com", headers=headers, timeout=5
  138. )
  139. @patch("hc.api.transports.requests.request")
  140. def test_webhooks_handle_json_up_event(self, mock_request):
  141. definition = {
  142. "method_up": "GET",
  143. "url_up": "http://bar",
  144. "body_up": "",
  145. "headers_up": {},
  146. }
  147. self._setup_data("webhook", json.dumps(definition), status="up")
  148. self.channel.notify(self.check)
  149. headers = {"User-Agent": "healthchecks.io"}
  150. mock_request.assert_called_with("get", "http://bar", headers=headers, timeout=5)
  151. @patch("hc.api.transports.requests.request")
  152. def test_webhooks_handle_post_headers(self, mock_request):
  153. definition = {
  154. "method_down": "POST",
  155. "url_down": "http://foo.com",
  156. "body_down": "data",
  157. "headers_down": {"Content-Type": "application/json"},
  158. }
  159. self._setup_data("webhook", json.dumps(definition))
  160. self.channel.notify(self.check)
  161. headers = {"User-Agent": "healthchecks.io", "Content-Type": "application/json"}
  162. mock_request.assert_called_with(
  163. "post", "http://foo.com", data=b"data", headers=headers, timeout=5
  164. )
  165. @patch("hc.api.transports.requests.request")
  166. def test_webhooks_handle_get_headers(self, mock_request):
  167. definition = {
  168. "method_down": "GET",
  169. "url_down": "http://foo.com",
  170. "body_down": "",
  171. "headers_down": {"Content-Type": "application/json"},
  172. }
  173. self._setup_data("webhook", json.dumps(definition))
  174. self.channel.notify(self.check)
  175. headers = {"User-Agent": "healthchecks.io", "Content-Type": "application/json"}
  176. mock_request.assert_called_with(
  177. "get", "http://foo.com", headers=headers, timeout=5
  178. )
  179. @patch("hc.api.transports.requests.request")
  180. def test_webhooks_allow_user_agent_override(self, mock_request):
  181. definition = {
  182. "method_down": "GET",
  183. "url_down": "http://foo.com",
  184. "body_down": "",
  185. "headers_down": {"User-Agent": "My-Agent"},
  186. }
  187. self._setup_data("webhook", json.dumps(definition))
  188. self.channel.notify(self.check)
  189. headers = {"User-Agent": "My-Agent"}
  190. mock_request.assert_called_with(
  191. "get", "http://foo.com", headers=headers, timeout=5
  192. )
  193. @patch("hc.api.transports.requests.request")
  194. def test_webhooks_support_variables_in_headers(self, mock_request):
  195. definition = {
  196. "method_down": "GET",
  197. "url_down": "http://foo.com",
  198. "body_down": "",
  199. "headers_down": {"X-Message": "$NAME is DOWN"},
  200. }
  201. self._setup_data("webhook", json.dumps(definition))
  202. self.check.name = "Foo"
  203. self.check.save()
  204. self.channel.notify(self.check)
  205. headers = {"User-Agent": "healthchecks.io", "X-Message": "Foo is DOWN"}
  206. mock_request.assert_called_with(
  207. "get", "http://foo.com", headers=headers, timeout=5
  208. )
  209. def test_email(self):
  210. self._setup_data("email", "[email protected]")
  211. self.channel.notify(self.check)
  212. n = Notification.objects.get()
  213. self.assertEqual(n.error, "")
  214. # And email should have been sent
  215. self.assertEqual(len(mail.outbox), 1)
  216. email = mail.outbox[0]
  217. self.assertEqual(email.to[0], "[email protected]")
  218. self.assertTrue("X-Bounce-Url" in email.extra_headers)
  219. self.assertTrue("List-Unsubscribe" in email.extra_headers)
  220. def test_email_transport_handles_json_value(self):
  221. payload = {"value": "[email protected]", "up": True, "down": True}
  222. self._setup_data("email", json.dumps(payload))
  223. self.channel.notify(self.check)
  224. # And email should have been sent
  225. self.assertEqual(len(mail.outbox), 1)
  226. email = mail.outbox[0]
  227. self.assertEqual(email.to[0], "[email protected]")
  228. def test_it_skips_unverified_email(self):
  229. self._setup_data("email", "[email protected]", email_verified=False)
  230. self.channel.notify(self.check)
  231. # If an email is not verified, it should be skipped over
  232. # without logging a notification:
  233. self.assertEqual(Notification.objects.count(), 0)
  234. self.assertEqual(len(mail.outbox), 0)
  235. def test_email_checks_up_down_flags(self):
  236. payload = {"value": "[email protected]", "up": True, "down": False}
  237. self._setup_data("email", json.dumps(payload))
  238. self.channel.notify(self.check)
  239. # This channel should not notify on "down" events:
  240. self.assertEqual(Notification.objects.count(), 0)
  241. self.assertEqual(len(mail.outbox), 0)
  242. @patch("hc.api.transports.requests.request")
  243. def test_pd(self, mock_post):
  244. self._setup_data("pd", "123")
  245. mock_post.return_value.status_code = 200
  246. self.channel.notify(self.check)
  247. assert Notification.objects.count() == 1
  248. args, kwargs = mock_post.call_args
  249. payload = kwargs["json"]
  250. self.assertEqual(payload["event_type"], "trigger")
  251. self.assertEqual(payload["service_key"], "123")
  252. @patch("hc.api.transports.requests.request")
  253. def test_pd_complex(self, mock_post):
  254. self._setup_data("pd", json.dumps({"service_key": "456"}))
  255. mock_post.return_value.status_code = 200
  256. self.channel.notify(self.check)
  257. assert Notification.objects.count() == 1
  258. args, kwargs = mock_post.call_args
  259. payload = kwargs["json"]
  260. self.assertEqual(payload["event_type"], "trigger")
  261. self.assertEqual(payload["service_key"], "456")
  262. @patch("hc.api.transports.requests.request")
  263. def test_pagertree(self, mock_post):
  264. self._setup_data("pagertree", "123")
  265. mock_post.return_value.status_code = 200
  266. self.channel.notify(self.check)
  267. assert Notification.objects.count() == 1
  268. args, kwargs = mock_post.call_args
  269. payload = kwargs["json"]
  270. self.assertEqual(payload["event_type"], "trigger")
  271. @patch("hc.api.transports.requests.request")
  272. def test_pagerteam(self, mock_post):
  273. self._setup_data("pagerteam", "123")
  274. mock_post.return_value.status_code = 200
  275. self.channel.notify(self.check)
  276. assert Notification.objects.count() == 1
  277. args, kwargs = mock_post.call_args
  278. payload = kwargs["json"]
  279. self.assertEqual(payload["event_type"], "trigger")
  280. @patch("hc.api.transports.requests.request")
  281. def test_slack(self, mock_post):
  282. self._setup_data("slack", "123")
  283. mock_post.return_value.status_code = 200
  284. self.channel.notify(self.check)
  285. assert Notification.objects.count() == 1
  286. args, kwargs = mock_post.call_args
  287. payload = kwargs["json"]
  288. attachment = payload["attachments"][0]
  289. fields = {f["title"]: f["value"] for f in attachment["fields"]}
  290. self.assertEqual(fields["Last Ping"], "an hour ago")
  291. @patch("hc.api.transports.requests.request")
  292. def test_slack_with_complex_value(self, mock_post):
  293. v = json.dumps({"incoming_webhook": {"url": "123"}})
  294. self._setup_data("slack", v)
  295. mock_post.return_value.status_code = 200
  296. self.channel.notify(self.check)
  297. assert Notification.objects.count() == 1
  298. args, kwargs = mock_post.call_args
  299. self.assertEqual(args[1], "123")
  300. @patch("hc.api.transports.requests.request")
  301. def test_slack_handles_500(self, mock_post):
  302. self._setup_data("slack", "123")
  303. mock_post.return_value.status_code = 500
  304. self.channel.notify(self.check)
  305. n = Notification.objects.get()
  306. self.assertEqual(n.error, "Received status code 500")
  307. @patch("hc.api.transports.requests.request", side_effect=Timeout)
  308. def test_slack_handles_timeout(self, mock_post):
  309. self._setup_data("slack", "123")
  310. self.channel.notify(self.check)
  311. n = Notification.objects.get()
  312. self.assertEqual(n.error, "Connection timed out")
  313. @patch("hc.api.transports.requests.request")
  314. def test_slack_with_tabs_in_schedule(self, mock_post):
  315. self._setup_data("slack", "123")
  316. self.check.kind = "cron"
  317. self.check.schedule = "*\t* * * *"
  318. self.check.save()
  319. mock_post.return_value.status_code = 200
  320. self.channel.notify(self.check)
  321. self.assertEqual(Notification.objects.count(), 1)
  322. self.assertTrue(mock_post.called)
  323. @patch("hc.api.transports.requests.request")
  324. def test_hipchat(self, mock_post):
  325. self._setup_data("hipchat", "123")
  326. self.channel.notify(self.check)
  327. self.assertFalse(mock_post.called)
  328. self.assertEqual(Notification.objects.count(), 0)
  329. @patch("hc.api.transports.requests.request")
  330. def test_opsgenie(self, mock_post):
  331. self._setup_data("opsgenie", "123")
  332. mock_post.return_value.status_code = 202
  333. self.channel.notify(self.check)
  334. n = Notification.objects.first()
  335. self.assertEqual(n.error, "")
  336. self.assertEqual(mock_post.call_count, 1)
  337. args, kwargs = mock_post.call_args
  338. payload = kwargs["json"]
  339. self.assertIn("DOWN", payload["message"])
  340. @patch("hc.api.transports.requests.request")
  341. def test_opsgenie_up(self, mock_post):
  342. self._setup_data("opsgenie", "123", status="up")
  343. mock_post.return_value.status_code = 202
  344. self.channel.notify(self.check)
  345. n = Notification.objects.first()
  346. self.assertEqual(n.error, "")
  347. self.assertEqual(mock_post.call_count, 1)
  348. args, kwargs = mock_post.call_args
  349. method, url = args
  350. self.assertTrue(str(self.check.code) in url)
  351. @patch("hc.api.transports.requests.request")
  352. def test_pushover(self, mock_post):
  353. self._setup_data("po", "123|0")
  354. mock_post.return_value.status_code = 200
  355. self.channel.notify(self.check)
  356. assert Notification.objects.count() == 1
  357. args, kwargs = mock_post.call_args
  358. payload = kwargs["data"]
  359. self.assertIn("DOWN", payload["title"])
  360. @patch("hc.api.transports.requests.request")
  361. def test_pushover_up_priority(self, mock_post):
  362. self._setup_data("po", "123|0|2", status="up")
  363. mock_post.return_value.status_code = 200
  364. self.channel.notify(self.check)
  365. assert Notification.objects.count() == 1
  366. args, kwargs = mock_post.call_args
  367. payload = kwargs["data"]
  368. self.assertIn("UP", payload["title"])
  369. self.assertEqual(payload["priority"], 2)
  370. self.assertIn("retry", payload)
  371. self.assertIn("expire", payload)
  372. @patch("hc.api.transports.requests.request")
  373. def test_victorops(self, mock_post):
  374. self._setup_data("victorops", "123")
  375. mock_post.return_value.status_code = 200
  376. self.channel.notify(self.check)
  377. assert Notification.objects.count() == 1
  378. args, kwargs = mock_post.call_args
  379. payload = kwargs["json"]
  380. self.assertEqual(payload["message_type"], "CRITICAL")
  381. @patch("hc.api.transports.requests.request")
  382. def test_discord(self, mock_post):
  383. v = json.dumps({"webhook": {"url": "123"}})
  384. self._setup_data("discord", v)
  385. mock_post.return_value.status_code = 200
  386. self.channel.notify(self.check)
  387. assert Notification.objects.count() == 1
  388. args, kwargs = mock_post.call_args
  389. payload = kwargs["json"]
  390. attachment = payload["attachments"][0]
  391. fields = {f["title"]: f["value"] for f in attachment["fields"]}
  392. self.assertEqual(fields["Last Ping"], "an hour ago")
  393. @patch("hc.api.transports.requests.request")
  394. def test_pushbullet(self, mock_post):
  395. self._setup_data("pushbullet", "fake-token")
  396. mock_post.return_value.status_code = 200
  397. self.channel.notify(self.check)
  398. assert Notification.objects.count() == 1
  399. _, kwargs = mock_post.call_args
  400. self.assertEqual(kwargs["json"]["type"], "note")
  401. self.assertEqual(kwargs["headers"]["Access-Token"], "fake-token")
  402. @patch("hc.api.transports.requests.request")
  403. def test_telegram(self, mock_post):
  404. v = json.dumps({"id": 123})
  405. self._setup_data("telegram", v)
  406. mock_post.return_value.status_code = 200
  407. self.channel.notify(self.check)
  408. assert Notification.objects.count() == 1
  409. args, kwargs = mock_post.call_args
  410. payload = kwargs["json"]
  411. self.assertEqual(payload["chat_id"], 123)
  412. self.assertTrue("The check" in payload["text"])
  413. @patch("hc.api.transports.requests.request")
  414. def test_sms(self, mock_post):
  415. self._setup_data("sms", "+1234567890")
  416. self.check.last_ping = now() - td(hours=2)
  417. mock_post.return_value.status_code = 200
  418. self.channel.notify(self.check)
  419. self.assertEqual(Notification.objects.count(), 1)
  420. args, kwargs = mock_post.call_args
  421. payload = kwargs["data"]
  422. self.assertEqual(payload["To"], "+1234567890")
  423. self.assertFalse("\xa0" in payload["Body"])
  424. # sent SMS counter should go up
  425. self.profile.refresh_from_db()
  426. self.assertEqual(self.profile.sms_sent, 1)
  427. @patch("hc.api.transports.requests.request")
  428. def test_sms_handles_json_value(self, mock_post):
  429. value = {"label": "foo", "value": "+1234567890"}
  430. self._setup_data("sms", json.dumps(value))
  431. self.check.last_ping = now() - td(hours=2)
  432. mock_post.return_value.status_code = 200
  433. self.channel.notify(self.check)
  434. assert Notification.objects.count() == 1
  435. args, kwargs = mock_post.call_args
  436. payload = kwargs["data"]
  437. self.assertEqual(payload["To"], "+1234567890")
  438. @patch("hc.api.transports.requests.request")
  439. def test_sms_limit(self, mock_post):
  440. # At limit already:
  441. self.profile.last_sms_date = now()
  442. self.profile.sms_sent = 50
  443. self.profile.save()
  444. self._setup_data("sms", "+1234567890")
  445. self.channel.notify(self.check)
  446. self.assertFalse(mock_post.called)
  447. n = Notification.objects.get()
  448. self.assertTrue("Monthly SMS limit exceeded" in n.error)
  449. @patch("hc.api.transports.requests.request")
  450. def test_sms_limit_reset(self, mock_post):
  451. # At limit, but also into a new month
  452. self.profile.sms_sent = 50
  453. self.profile.last_sms_date = now() - td(days=100)
  454. self.profile.save()
  455. self._setup_data("sms", "+1234567890")
  456. mock_post.return_value.status_code = 200
  457. self.channel.notify(self.check)
  458. self.assertTrue(mock_post.called)
  459. @patch("hc.api.transports.requests.request")
  460. def test_whatsapp(self, mock_post):
  461. definition = {"value": "+1234567890", "up": True, "down": True}
  462. self._setup_data("whatsapp", json.dumps(definition))
  463. self.check.last_ping = now() - td(hours=2)
  464. mock_post.return_value.status_code = 200
  465. self.channel.notify(self.check)
  466. self.assertEqual(Notification.objects.count(), 1)
  467. args, kwargs = mock_post.call_args
  468. payload = kwargs["data"]
  469. self.assertEqual(payload["To"], "whatsapp:+1234567890")
  470. # sent SMS counter should go up
  471. self.profile.refresh_from_db()
  472. self.assertEqual(self.profile.sms_sent, 1)
  473. @patch("hc.api.transports.requests.request")
  474. def test_whatsapp_obeys_up_down_flags(self, mock_post):
  475. definition = {"value": "+1234567890", "up": True, "down": False}
  476. self._setup_data("whatsapp", json.dumps(definition))
  477. self.check.last_ping = now() - td(hours=2)
  478. self.channel.notify(self.check)
  479. self.assertEqual(Notification.objects.count(), 0)
  480. self.assertFalse(mock_post.called)
  481. @patch("hc.api.transports.requests.request")
  482. def test_whatsapp_limit(self, mock_post):
  483. # At limit already:
  484. self.profile.last_sms_date = now()
  485. self.profile.sms_sent = 50
  486. self.profile.save()
  487. definition = {"value": "+1234567890", "up": True, "down": True}
  488. self._setup_data("whatsapp", json.dumps(definition))
  489. self.channel.notify(self.check)
  490. self.assertFalse(mock_post.called)
  491. n = Notification.objects.get()
  492. self.assertTrue("Monthly message limit exceeded" in n.error)
  493. @patch("apprise.Apprise")
  494. @override_settings(APPRISE_ENABLED=True)
  495. def test_apprise_enabled(self, mock_apprise):
  496. self._setup_data("apprise", "123")
  497. mock_aobj = Mock()
  498. mock_aobj.add.return_value = True
  499. mock_aobj.notify.return_value = True
  500. mock_apprise.return_value = mock_aobj
  501. self.channel.notify(self.check)
  502. self.assertEqual(Notification.objects.count(), 1)
  503. self.check.status = "up"
  504. self.assertEqual(Notification.objects.count(), 1)
  505. @patch("apprise.Apprise")
  506. @override_settings(APPRISE_ENABLED=False)
  507. def test_apprise_disabled(self, mock_apprise):
  508. self._setup_data("apprise", "123")
  509. mock_aobj = Mock()
  510. mock_aobj.add.return_value = True
  511. mock_aobj.notify.return_value = True
  512. mock_apprise.return_value = mock_aobj
  513. self.channel.notify(self.check)
  514. self.assertEqual(Notification.objects.count(), 1)
  515. def test_not_implimented(self):
  516. self._setup_data("webhook", "http://example")
  517. self.channel.kind = "invalid"
  518. with self.assertRaises(NotImplementedError):
  519. self.channel.notify(self.check)