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: Added tests for urlFilters Created Sept. 21, 2017, 8:14 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:
Left: Side by side diff | Download
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
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 self.assertEqual(notifications[3]['severity'], 'relentless') 155 self.assertEqual(notifications[3]['severity'], 'relentless')
156 156
157 def test_urls(self): 157 def test_urls(self):
158 self.notification_to_load = [ 158 self.notification_to_load = [
159 ('1', '\nurls = adblockplus.org\n'), 159 ('1', '\nurls = adblockplus.org\n'),
160 ('1', '\nurls = adblockplus.org eyeo.com\n'), 160 ('1', '\nurls = adblockplus.org eyeo.com\n'),
161 ] 161 ]
162 notifications = parser.load_notifications() 162 notifications = parser.load_notifications()
163 163
164 assert len(notifications) == 2 164 assert len(notifications) == 2
165 165 assert notifications[0]['urlFilters'] == ['ADBLOCKPLUS.ORG^$document']
166 self.assertEqual( 166 assert notifications[1]['urlFilters'] == [
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', 167 'ADBLOCKPLUS.ORG^$document',
170 'EYEO.COM^$document']) 168 'EYEO.COM^$document']
171 169
172 170
173 if __name__ == '__main__': 171 if __name__ == '__main__':
174 unittest.main() 172 unittest.main()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld