| Index: sitescripts/notifications/test/parser.py |
| diff --git a/sitescripts/notifications/test/parser.py b/sitescripts/notifications/test/parser.py |
| index 2b029244078578a127ce5cdbab1871138e19b543..e194c8b65ff25de2db0b4519244ecf37fc10f3b5 100644 |
| --- a/sitescripts/notifications/test/parser.py |
| +++ b/sitescripts/notifications/test/parser.py |
| @@ -167,6 +167,73 @@ end = %s |
| 'ADBLOCKPLUS.ORG^$document', |
| 'EYEO.COM^$document']) |
| + def test_target(self): |
| + self.notification_to_load = [ |
| + ('1', '\ntarget = extension=adblockplus\n'), |
| + ('2', '\ntarget = extensionVersion=1.2.3\n'), |
| + ('3', '\ntarget = extensionVersion>=1.2.3\n'), |
| + ('4', '\ntarget = extensionVersion<=1.2.3\n'), |
| + ('5', '\ntarget = application=chrome\n'), |
| + ('6', '\ntarget = applicationVersion=1.2.3\n'), |
| + ('7', '\ntarget = applicationVersion>=1.2.3\n'), |
| + ('8', '\ntarget = applicationVersion<=1.2.3\n'), |
| + ('9', '\ntarget = platform=chromium\n'), |
| + ('10', '\ntarget = platformVersion=1.2.3\n'), |
| + ('11', '\ntarget = platformVersion>=1.2.3\n'), |
| + ('12', '\ntarget = platformVersion<=1.2.3\n'), |
| + ('13', '\ntarget = blockedTotal=10\n'), |
| + ('14', '\ntarget = blockedTotal>=10\n'), |
| + ('15', '\ntarget = blockedTotal<=10\n'), |
| + ('16', '\ntarget = locales=en-US\n'), |
| + ('17', '\ntarget = locales=en-US,de-DE\n'), |
| + ] |
| + |
| + notifications = parser.load_notifications() |
| + 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
|
| + |
| + self.assertEqual( |
| + notifications[0]['targets'][0]['extension'], 'adblockplus') |
| + self.assertEqual( |
| + notifications[1]['targets'][0]['extensionMinVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[1]['targets'][0]['extensionMaxVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[2]['targets'][0]['extensionMinVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[3]['targets'][0]['extensionMaxVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[4]['targets'][0]['application'], 'chrome') |
| + self.assertEqual( |
| + notifications[5]['targets'][0]['applicationMinVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[5]['targets'][0]['applicationMaxVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[6]['targets'][0]['applicationMinVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[7]['targets'][0]['applicationMaxVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[8]['targets'][0]['platform'], 'chromium') |
| + self.assertEqual( |
| + notifications[9]['targets'][0]['platformMinVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[9]['targets'][0]['platformMaxVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[10]['targets'][0]['platformMinVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[11]['targets'][0]['platformMaxVersion'], '1.2.3') |
| + self.assertEqual( |
| + notifications[12]['targets'][0]['blockedTotalMin'], 10) |
| + self.assertEqual( |
| + notifications[12]['targets'][0]['blockedTotalMax'], 10) |
| + self.assertEqual( |
| + notifications[13]['targets'][0]['blockedTotalMin'], 10) |
| + self.assertEqual( |
| + notifications[14]['targets'][0]['blockedTotalMax'], 10) |
| + self.assertEqual( |
| + notifications[15]['targets'][0]['locales'], ['en-US']) |
| + self.assertEqual( |
| + notifications[16]['targets'][0]['locales'], ['en-US', 'de-DE']) |
| + |
| if __name__ == '__main__': |
| unittest.main() |