forked from Khan/khan-webhooks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phabricator_fox_test.py
34 lines (25 loc) · 1.14 KB
/
phabricator_fox_test.py
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
30
31
32
33
34
# TODO(colin): fix these lint errors (http://pep8.readthedocs.io/en/release-1.7.x/intro.html#error-codes)
# pep8-disable:E128
import unittest
import re
import phabricator_fox
# These example strings were taken from the logs of
# https://console.cloud.google.com/logs/viewer?project=khan-webhooks
ABANDONED_TEXT = ("kevinb abandoned D33306: "
"Remove most the lint in CircularProgressIcon.")
CREATED_TEXT = ("amy created D33337: "
"Separate out item attempts from task completion.")
ADDED_REVIEWER = ("amy added a reviewer for D33318: "
"Update hover interaction to match the spec: kimerie.")
class PagerParrotLogicTest(unittest.TestCase):
def test_created_message(self):
match = re.match(phabricator_fox.MESSAGE_RX, CREATED_TEXT)
self.assertIsNotNone(match)
def test_abandoned_message(self):
match = re.match(phabricator_fox.MESSAGE_RX, ABANDONED_TEXT)
self.assertIsNotNone(match)
def test_abandoned_message(self):
match = re.match(phabricator_fox.MESSAGE_RX, ADDED_REVIEWER)
self.assertIsNone(match)
if __name__ == '__main__':
unittest.main()