OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 self.load_notifications_mock.return_value = [ | 354 self.load_notifications_mock.return_value = [ |
355 {"id": "a", "title": {"en-US": ""}, "message": {"en-US": ""}, "inactive":
True}, | 355 {"id": "a", "title": {"en-US": ""}, "message": {"en-US": ""}, "inactive":
True}, |
356 {"id": "b", "title": {"en-US": ""}, "message": {"en-US": ""}, "inactive":
False}, | 356 {"id": "b", "title": {"en-US": ""}, "message": {"en-US": ""}, "inactive":
False}, |
357 {"id": "c", "title": {"en-US": ""}, "message": {"en-US": ""}} | 357 {"id": "c", "title": {"en-US": ""}, "message": {"en-US": ""}} |
358 ] | 358 ] |
359 result = json.loads(notification.notification({}, lambda *args: None)) | 359 result = json.loads(notification.notification({}, lambda *args: None)) |
360 self.assertEqual(len(result["notifications"]), 2) | 360 self.assertEqual(len(result["notifications"]), 2) |
361 self.assertEqual(result["notifications"][0]["id"], "b") | 361 self.assertEqual(result["notifications"][0]["id"], "b") |
362 self.assertEqual(result["notifications"][1]["id"], "c") | 362 self.assertEqual(result["notifications"][1]["id"], "c") |
363 | 363 |
| 364 def test_inactive_notification_variant_not_returned(self): |
| 365 self.load_notifications_mock.return_value = [ |
| 366 {"id": "a", "inactive": True} |
| 367 ] |
| 368 result = json.loads(notification.notification({ |
| 369 "QUERY_STRING": "lastVersion=197001010000-a/1" |
| 370 }, lambda *args: None)) |
| 371 self.assertEqual(len(result["notifications"]), 0) |
| 372 |
364 if __name__ == '__main__': | 373 if __name__ == '__main__': |
365 unittest.main() | 374 unittest.main() |
OLD | NEW |