LEFT | RIGHT |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 severity = information | 56 severity = information |
57 title.en-US = The title | 57 title.en-US = The title |
58 message.en-US = The message | 58 message.en-US = The message |
59 """) | 59 """) |
60 notifications = parser.load_notifications() | 60 notifications = parser.load_notifications() |
61 self.assertEqual(len(notifications), 1) | 61 self.assertEqual(len(notifications), 1) |
62 self.assertEqual(notifications[0]["id"], "1") | 62 self.assertEqual(notifications[0]["id"], "1") |
63 self.assertEqual(notifications[0]["severity"], "information") | 63 self.assertEqual(notifications[0]["severity"], "information") |
64 self.assertEqual(notifications[0]["title"]["en-US"], "The title") | 64 self.assertEqual(notifications[0]["title"]["en-US"], "The title") |
65 self.assertEqual(notifications[0]["message"]["en-US"], "The message") | 65 self.assertEqual(notifications[0]["message"]["en-US"], "The message") |
| 66 self.assertNotIn("inactive", notifications[0]) |
66 | 67 |
67 def test_inactive(self): | 68 def test_inactive(self): |
68 self.notification_to_load = ("1", """ | 69 self.notification_to_load = ("1", """ |
69 inactive = True | 70 inactive = True |
70 """) | 71 """) |
71 notifications = parser.load_notifications() | 72 notifications = parser.load_notifications() |
72 self.assertEqual(len(notifications), 1) | 73 self.assertEqual(len(notifications), 1) |
73 self.assertTrue(notifications[0]["inactive"]) | 74 self.assertTrue(notifications[0]["inactive"]) |
74 | 75 |
75 def test_in_range(self): | 76 def test_in_range(self): |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 current_time = datetime.datetime.now() | 115 current_time = datetime.datetime.now() |
115 hour_delta = datetime.timedelta(hours=1) | 116 hour_delta = datetime.timedelta(hours=1) |
116 start_time = current_time - hour_delta | 117 start_time = current_time - hour_delta |
117 end_time = current_time + hour_delta | 118 end_time = current_time + hour_delta |
118 self.notification_to_load = ("1", """ | 119 self.notification_to_load = ("1", """ |
119 start = %s | 120 start = %s |
120 end = %s | 121 end = %s |
121 """ % (_format_time(start_time), _format_time(end_time))) | 122 """ % (_format_time(start_time), _format_time(end_time))) |
122 notifications = parser.load_notifications() | 123 notifications = parser.load_notifications() |
123 self.assertEqual(len(notifications), 1) | 124 self.assertEqual(len(notifications), 1) |
| 125 self.assertNotIn("inactive", notifications[0]) |
124 self.assertNotIn("start", notifications[0]) | 126 self.assertNotIn("start", notifications[0]) |
125 self.assertNotIn("end", notifications[0]) | 127 self.assertNotIn("end", notifications[0]) |
126 | 128 |
127 if __name__ == "__main__": | 129 if __name__ == "__main__": |
128 unittest.main() | 130 unittest.main() |
LEFT | RIGHT |