Index: sitescripts/notifications/test/parser.py |
diff --git a/sitescripts/notifications/test/parser.py b/sitescripts/notifications/test/parser.py |
index 2b029244078578a127ce5cdbab1871138e19b543..95a15a9b2aa518a98a90fb78be758bffcc7c5279 100644 |
--- a/sitescripts/notifications/test/parser.py |
+++ b/sitescripts/notifications/test/parser.py |
@@ -167,6 +167,74 @@ 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() |
+ |
+ 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
|
+ |
+ self.assertEqual( |
+ 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.
|
+ 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() |