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

Unified Diff: sitescripts/notifications/test/parser.py

Issue 29327106: Issue 3048 - Mark inactive notifications instead of removing them (Closed)
Patch Set: Simplify range selection and inactive check Created Sept. 11, 2015, 7:03 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sitescripts/notifications/test/notification.py ('k') | sitescripts/notifications/web/notification.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/notifications/test/parser.py
===================================================================
--- a/sitescripts/notifications/test/parser.py
+++ b/sitescripts/notifications/test/parser.py
@@ -63,13 +63,15 @@
self.assertEqual(notifications[0]["severity"], "information")
self.assertEqual(notifications[0]["title"]["en-US"], "The title")
self.assertEqual(notifications[0]["message"]["en-US"], "The message")
+ self.assertNotIn("inactive", notifications[0])
def test_inactive(self):
self.notification_to_load = ("1", """
inactive = True
""")
notifications = parser.load_notifications()
- self.assertEqual(len(notifications), 0)
+ self.assertEqual(len(notifications), 1)
+ self.assertTrue(notifications[0]["inactive"])
def test_in_range(self):
current_time = datetime.datetime.now()
@@ -83,6 +85,7 @@
notifications = parser.load_notifications()
self.assertEqual(len(notifications), 1)
self.assertEqual(notifications[0]["id"], "1")
+ self.assertNotIn("inactive", notifications[0])
def test_after_range(self):
current_time = datetime.datetime.now()
@@ -93,7 +96,8 @@
end = %s
""" % (_format_time(start_time), _format_time(end_time)))
notifications = parser.load_notifications()
- self.assertEqual(len(notifications), 0)
+ self.assertEqual(len(notifications), 1)
+ self.assertTrue(notifications[0]["inactive"])
def test_before_range(self):
current_time = datetime.datetime.now()
@@ -104,7 +108,8 @@
end = %s
""" % (_format_time(start_time), _format_time(end_time)))
notifications = parser.load_notifications()
- self.assertEqual(len(notifications), 0)
+ self.assertEqual(len(notifications), 1)
+ self.assertTrue(notifications[0]["inactive"])
def test_start_and_end_not_present(self):
current_time = datetime.datetime.now()
@@ -117,6 +122,7 @@
""" % (_format_time(start_time), _format_time(end_time)))
notifications = parser.load_notifications()
self.assertEqual(len(notifications), 1)
+ self.assertNotIn("inactive", notifications[0])
self.assertNotIn("start", notifications[0])
self.assertNotIn("end", notifications[0])
« no previous file with comments | « sitescripts/notifications/test/notification.py ('k') | sitescripts/notifications/web/notification.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld