Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Unified Diff: appengine/monorail/framework/test/alerts_test.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/monorail/framework/test/alerts_test.py
diff --git a/appengine/monorail/framework/test/alerts_test.py b/appengine/monorail/framework/test/alerts_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd420e25cad80d324b6dc815b7fae0d4a4d40769
--- /dev/null
+++ b/appengine/monorail/framework/test/alerts_test.py
@@ -0,0 +1,44 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is govered by a BSD-style
+# license that can be found in the LICENSE file or at
+# https://developers.google.com/open-source/licenses/bsd
+
+"""Tests for alert display helpers."""
+
+import time
+import unittest
+
+from third_party import ezt
+
+from framework import alerts
+from testing import fake
+from testing import testing_helpers
+
+
+class AlertsViewTest(unittest.TestCase):
+
+ def testTimestamp(self):
+ """Tests that alerts are only shown when the timestamp is valid."""
+ project = fake.Project(project_name='testproj')
+
+ now = int(time.time())
+ mr = testing_helpers.MakeMonorailRequest(
+ path='/p/testproj/?updated=10&ts=%s' % now, project=project)
+ alerts_view = alerts.AlertsView(mr)
+ self.assertEqual(10, alerts_view.updated)
+ self.assertEqual(ezt.boolean(True), alerts_view.show)
+
+ now -= 10
+ mr = testing_helpers.MakeMonorailRequest(
+ path='/p/testproj/?updated=10&ts=%s' % now, project=project)
+ alerts_view = alerts.AlertsView(mr)
+ self.assertEqual(ezt.boolean(False), alerts_view.show)
+
+ mr = testing_helpers.MakeMonorailRequest(
+ path='/p/testproj/?updated=10', project=project)
+ alerts_view = alerts.AlertsView(mr)
+ self.assertEqual(ezt.boolean(False), alerts_view.show)
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « appengine/monorail/framework/test/actionlimit_test.py ('k') | appengine/monorail/framework/test/artifactcollision_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698