Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-2016 Eyeo GmbH | 2 # Copyright (C) 2006-2016 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 notifications = parser.load_notifications() | 63 notifications = parser.load_notifications() |
64 self.assertEqual(len(notifications), 1) | 64 self.assertEqual(len(notifications), 1) |
65 self.assertEqual(notifications[0]['id'], '1') | 65 self.assertEqual(notifications[0]['id'], '1') |
66 self.assertEqual(notifications[0]['severity'], 'information') | 66 self.assertEqual(notifications[0]['severity'], 'information') |
67 self.assertEqual(notifications[0]['title']['en-US'], 'The title') | 67 self.assertEqual(notifications[0]['title']['en-US'], 'The title') |
68 self.assertEqual(notifications[0]['message']['en-US'], 'The message') | 68 self.assertEqual(notifications[0]['message']['en-US'], 'The message') |
69 self.assertNotIn('inactive', notifications[0]) | 69 self.assertNotIn('inactive', notifications[0]) |
70 | 70 |
71 def test_inactive(self): | 71 def test_inactive(self): |
72 self.notification_to_load = [ | 72 self.notification_to_load = [ |
73 ('1', '\ninactive = Yes\n'), | 73 ('1', '\ninactive = Yes\n'), |
Vasily Kuznetsov
2017/01/25 11:14:58
When I run tox, flake8 complains about the indenta
wspee
2017/01/25 11:50:00
Done.
| |
74 ('2', '\ninactive = No\n'), | 74 ('2', '\ninactive = No\n'), |
75 ] | 75 ] |
76 notifications = parser.load_notifications() | 76 notifications = parser.load_notifications() |
77 self.assertEqual(len(notifications), 2) | 77 self.assertEqual(len(notifications), 2) |
78 self.assertTrue(notifications[0]['inactive']) | 78 self.assertTrue(notifications[0]['inactive']) |
79 self.assertFalse(notifications[1]['inactive']) | 79 self.assertFalse(notifications[1]['inactive']) |
80 | 80 |
81 def test_in_range(self): | 81 def test_in_range(self): |
82 current_time = datetime.datetime.now() | 82 current_time = datetime.datetime.now() |
83 hour_delta = datetime.timedelta(hours=1) | 83 hour_delta = datetime.timedelta(hours=1) |
84 start_time = current_time - hour_delta | 84 start_time = current_time - hour_delta |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 notifications = parser.load_notifications() | 150 notifications = parser.load_notifications() |
151 self.assertEqual(len(notifications), 4) | 151 self.assertEqual(len(notifications), 4) |
152 self.assertEqual(notifications[0]['severity'], 'information') | 152 self.assertEqual(notifications[0]['severity'], 'information') |
153 self.assertEqual(notifications[1]['severity'], 'critical') | 153 self.assertEqual(notifications[1]['severity'], 'critical') |
154 self.assertEqual(notifications[2]['severity'], 'normal') | 154 self.assertEqual(notifications[2]['severity'], 'normal') |
155 self.assertEqual(notifications[3]['severity'], 'relentless') | 155 self.assertEqual(notifications[3]['severity'], 'relentless') |
156 | 156 |
157 | 157 |
158 if __name__ == '__main__': | 158 if __name__ == '__main__': |
159 unittest.main() | 159 unittest.main() |
LEFT | RIGHT |