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

Delta Between Two Patch Sets: sitescripts/notifications/test/parser.py

Issue 29500676: Issue 5456 - Add support to specify urlFilters in the notification repository (Closed)
Left Patch Set: Addressed formatting comments Created Aug. 4, 2017, 8:40 a.m.
Right Patch Set: Use assert instead of assertEqual Created Sept. 21, 2017, 10:09 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « sitescripts/notifications/parser.py ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 assert notifications[0]['urlFilters'] == ['ADBLOCKPLUS.ORG^$document']
166 assert notifications[1]['urlFilters'] == [
167 'ADBLOCKPLUS.ORG^$document',
168 'EYEO.COM^$document']
169
157 170
158 if __name__ == '__main__': 171 if __name__ == '__main__':
159 unittest.main() 172 unittest.main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld