Left: | ||
Right: |
OLD | NEW |
---|---|
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 self.assertEqual(len(notifications), 2) | 163 self.assertEqual(len(notifications), 2) |
164 self.assertEqual( | 164 self.assertEqual( |
165 notifications[0]['urlFilters'], ['ADBLOCKPLUS.ORG^$document']) | 165 notifications[0]['urlFilters'], ['ADBLOCKPLUS.ORG^$document']) |
166 self.assertEqual(notifications[1]['urlFilters'], [ | 166 self.assertEqual(notifications[1]['urlFilters'], [ |
167 'ADBLOCKPLUS.ORG^$document', | 167 'ADBLOCKPLUS.ORG^$document', |
168 'EYEO.COM^$document']) | 168 'EYEO.COM^$document']) |
169 | 169 |
170 def test_target(self): | |
171 self.notification_to_load = [ | |
172 ('1', '\ntarget = extension=adblockplus\n'), | |
173 ('2', '\ntarget = extensionVersion=1.2.3\n'), | |
174 ('3', '\ntarget = extensionVersion>=1.2.3\n'), | |
175 ('4', '\ntarget = extensionVersion<=1.2.3\n'), | |
176 ('5', '\ntarget = application=chrome\n'), | |
177 ('6', '\ntarget = applicationVersion=1.2.3\n'), | |
178 ('7', '\ntarget = applicationVersion>=1.2.3\n'), | |
179 ('8', '\ntarget = applicationVersion<=1.2.3\n'), | |
180 ('9', '\ntarget = platform=chromium\n'), | |
181 ('10', '\ntarget = platformVersion=1.2.3\n'), | |
182 ('11', '\ntarget = platformVersion>=1.2.3\n'), | |
183 ('12', '\ntarget = platformVersion<=1.2.3\n'), | |
184 ('13', '\ntarget = blockedTotal=10\n'), | |
185 ('14', '\ntarget = blockedTotal>=10\n'), | |
186 ('15', '\ntarget = blockedTotal<=10\n'), | |
187 ('16', '\ntarget = locales=en-US\n'), | |
188 ('17', '\ntarget = locales=en-US,de-DE\n'), | |
189 ] | |
190 | |
191 notifications = parser.load_notifications() | |
192 | |
193 assert len(notifications) == 17 | |
Wladimir Palant
2017/09/21 09:24:02
I'd recommend switching back to self.assertEqual()
Vasily Kuznetsov
2017/09/21 09:41:30
Here's the error message that I get (after changin
wspee
2017/09/21 10:15:11
I agree with Vasily, using assert only provides ad
| |
194 | |
195 self.assertEqual( | |
196 notifications[0]['targets'][0]['extension'], 'adblockplus') | |
Wladimir Palant
2017/09/21 09:24:02
You should verify that there are no additional tar
wspee
2017/09/21 10:15:11
Done.
| |
197 self.assertEqual( | |
198 notifications[1]['targets'][0]['extensionMinVersion'], '1.2.3') | |
199 self.assertEqual( | |
200 notifications[1]['targets'][0]['extensionMaxVersion'], '1.2.3') | |
201 self.assertEqual( | |
202 notifications[2]['targets'][0]['extensionMinVersion'], '1.2.3') | |
203 self.assertEqual( | |
204 notifications[3]['targets'][0]['extensionMaxVersion'], '1.2.3') | |
205 self.assertEqual( | |
206 notifications[4]['targets'][0]['application'], 'chrome') | |
207 self.assertEqual( | |
208 notifications[5]['targets'][0]['applicationMinVersion'], '1.2.3') | |
209 self.assertEqual( | |
210 notifications[5]['targets'][0]['applicationMaxVersion'], '1.2.3') | |
211 self.assertEqual( | |
212 notifications[6]['targets'][0]['applicationMinVersion'], '1.2.3') | |
213 self.assertEqual( | |
214 notifications[7]['targets'][0]['applicationMaxVersion'], '1.2.3') | |
215 self.assertEqual( | |
216 notifications[8]['targets'][0]['platform'], 'chromium') | |
217 self.assertEqual( | |
218 notifications[9]['targets'][0]['platformMinVersion'], '1.2.3') | |
219 self.assertEqual( | |
220 notifications[9]['targets'][0]['platformMaxVersion'], '1.2.3') | |
221 self.assertEqual( | |
222 notifications[10]['targets'][0]['platformMinVersion'], '1.2.3') | |
223 self.assertEqual( | |
224 notifications[11]['targets'][0]['platformMaxVersion'], '1.2.3') | |
225 self.assertEqual( | |
226 notifications[12]['targets'][0]['blockedTotalMin'], 10) | |
227 self.assertEqual( | |
228 notifications[12]['targets'][0]['blockedTotalMax'], 10) | |
229 self.assertEqual( | |
230 notifications[13]['targets'][0]['blockedTotalMin'], 10) | |
231 self.assertEqual( | |
232 notifications[14]['targets'][0]['blockedTotalMax'], 10) | |
233 self.assertEqual( | |
234 notifications[15]['targets'][0]['locales'], ['en-US']) | |
235 self.assertEqual( | |
236 notifications[16]['targets'][0]['locales'], ['en-US', 'de-DE']) | |
237 | |
170 | 238 |
171 if __name__ == '__main__': | 239 if __name__ == '__main__': |
172 unittest.main() | 240 unittest.main() |
OLD | NEW |