Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/notifications/test/parser.py

Issue 29500676: Issue 5456 - Add support to specify urlFilters in the notification repository (Closed)
Patch Set: Added tests for urlFilters Created Sept. 21, 2017, 8:14 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/notifications/parser.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 ('3', '\nseverity = normal\n'), 147 ('3', '\nseverity = normal\n'),
148 ('4', '\nseverity = relentless\n'), 148 ('4', '\nseverity = relentless\n'),
149 ] 149 ]
150 notifications = parser.load_notifications() 150 notifications = parser.load_notifications()
151 self.assertEqual(len(notifications), 4) 151 self.assertEqual(len(notifications), 4)
152 self.assertEqual(notifications[0]['severity'], 'information') 152 self.assertEqual(notifications[0]['severity'], 'information')
153 self.assertEqual(notifications[1]['severity'], 'critical') 153 self.assertEqual(notifications[1]['severity'], 'critical')
154 self.assertEqual(notifications[2]['severity'], 'normal') 154 self.assertEqual(notifications[2]['severity'], 'normal')
155 self.assertEqual(notifications[3]['severity'], 'relentless') 155 self.assertEqual(notifications[3]['severity'], 'relentless')
156 156
157 def test_urls(self):
158 self.notification_to_load = [
159 ('1', '\nurls = adblockplus.org\n'),
160 ('1', '\nurls = adblockplus.org eyeo.com\n'),
161 ]
162 notifications = parser.load_notifications()
163
164 assert len(notifications) == 2
165
166 self.assertEqual(
Vasily Kuznetsov 2017/09/21 09:44:10 These following two asserts would look even better
wspee 2017/09/21 10:11:34 Done.
167 notifications[0]['urlFilters'], ['ADBLOCKPLUS.ORG^$document'])
168 self.assertEqual(notifications[1]['urlFilters'], [
169 'ADBLOCKPLUS.ORG^$document',
170 'EYEO.COM^$document'])
171
157 172
158 if __name__ == '__main__': 173 if __name__ == '__main__':
159 unittest.main() 174 unittest.main()
OLDNEW
« no previous file with comments | « sitescripts/notifications/parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld