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 self.assertEqual(len(notifications), 17) | |
Vasily Kuznetsov
2017/09/20 15:45:33
These tests are run with pytest nowadays, so you c
wspee
2017/09/21 08:10:52
Done.
Vasily Kuznetsov
2017/09/21 09:41:30
I actually meant it for all new assertions (the on
| |
193 | |
194 self.assertEqual( | |
195 notifications[0]['targets'][0]['extension'], 'adblockplus') | |
196 self.assertEqual( | |
197 notifications[1]['targets'][0]['extensionMinVersion'], '1.2.3') | |
198 self.assertEqual( | |
199 notifications[1]['targets'][0]['extensionMaxVersion'], '1.2.3') | |
200 self.assertEqual( | |
201 notifications[2]['targets'][0]['extensionMinVersion'], '1.2.3') | |
202 self.assertEqual( | |
203 notifications[3]['targets'][0]['extensionMaxVersion'], '1.2.3') | |
204 self.assertEqual( | |
205 notifications[4]['targets'][0]['application'], 'chrome') | |
206 self.assertEqual( | |
207 notifications[5]['targets'][0]['applicationMinVersion'], '1.2.3') | |
208 self.assertEqual( | |
209 notifications[5]['targets'][0]['applicationMaxVersion'], '1.2.3') | |
210 self.assertEqual( | |
211 notifications[6]['targets'][0]['applicationMinVersion'], '1.2.3') | |
212 self.assertEqual( | |
213 notifications[7]['targets'][0]['applicationMaxVersion'], '1.2.3') | |
214 self.assertEqual( | |
215 notifications[8]['targets'][0]['platform'], 'chromium') | |
216 self.assertEqual( | |
217 notifications[9]['targets'][0]['platformMinVersion'], '1.2.3') | |
218 self.assertEqual( | |
219 notifications[9]['targets'][0]['platformMaxVersion'], '1.2.3') | |
220 self.assertEqual( | |
221 notifications[10]['targets'][0]['platformMinVersion'], '1.2.3') | |
222 self.assertEqual( | |
223 notifications[11]['targets'][0]['platformMaxVersion'], '1.2.3') | |
224 self.assertEqual( | |
225 notifications[12]['targets'][0]['blockedTotalMin'], 10) | |
226 self.assertEqual( | |
227 notifications[12]['targets'][0]['blockedTotalMax'], 10) | |
228 self.assertEqual( | |
229 notifications[13]['targets'][0]['blockedTotalMin'], 10) | |
230 self.assertEqual( | |
231 notifications[14]['targets'][0]['blockedTotalMax'], 10) | |
232 self.assertEqual( | |
233 notifications[15]['targets'][0]['locales'], ['en-US']) | |
234 self.assertEqual( | |
235 notifications[16]['targets'][0]['locales'], ['en-US', 'de-DE']) | |
236 | |
170 | 237 |
171 if __name__ == '__main__': | 238 if __name__ == '__main__': |
172 unittest.main() | 239 unittest.main() |
OLD | NEW |