Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/notifications/test/parser.py

Issue 29322888: Issue 2707 - Remove start/end from notifications (Closed)
Patch Set: Refactoring Created July 29, 2015, 2:29 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sitescripts/notifications/parser.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 current_time = datetime.datetime.now() 99 current_time = datetime.datetime.now()
100 start_time = current_time + datetime.timedelta(hours=1) 100 start_time = current_time + datetime.timedelta(hours=1)
101 end_time = current_time + datetime.timedelta(hours=2) 101 end_time = current_time + datetime.timedelta(hours=2)
102 self.notification_to_load = ("1", """ 102 self.notification_to_load = ("1", """
103 start = %s 103 start = %s
104 end = %s 104 end = %s
105 """ % (_format_time(start_time), _format_time(end_time))) 105 """ % (_format_time(start_time), _format_time(end_time)))
106 notifications = parser.load_notifications() 106 notifications = parser.load_notifications()
107 self.assertEqual(len(notifications), 0) 107 self.assertEqual(len(notifications), 0)
108 108
109 def test_start_and_end_not_present(self):
110 current_time = datetime.datetime.now()
111 hour_delta = datetime.timedelta(hours=1)
112 start_time = current_time - hour_delta
113 end_time = current_time + hour_delta
114 self.notification_to_load = ("1", """
115 start = %s
116 end = %s
117 """ % (_format_time(start_time), _format_time(end_time)))
118 notifications = parser.load_notifications()
119 self.assertEqual(len(notifications), 1)
120 self.assertNotIn(notifications[0], "start")
121 self.assertNotIn(notifications[0], "end")
122
109 if __name__ == "__main__": 123 if __name__ == "__main__":
110 unittest.main() 124 unittest.main()
OLDNEW
« no previous file with comments | « sitescripts/notifications/parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld