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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Tests for alert display helpers."""
7
8 import time
9 import unittest
10
11 from third_party import ezt
12
13 from framework import alerts
14 from testing import fake
15 from testing import testing_helpers
16
17
18 class AlertsViewTest(unittest.TestCase):
19
20 def testTimestamp(self):
21 """Tests that alerts are only shown when the timestamp is valid."""
22 project = fake.Project(project_name='testproj')
23
24 now = int(time.time())
25 mr = testing_helpers.MakeMonorailRequest(
26 path='/p/testproj/?updated=10&ts=%s' % now, project=project)
27 alerts_view = alerts.AlertsView(mr)
28 self.assertEqual(10, alerts_view.updated)
29 self.assertEqual(ezt.boolean(True), alerts_view.show)
30
31 now -= 10
32 mr = testing_helpers.MakeMonorailRequest(
33 path='/p/testproj/?updated=10&ts=%s' % now, project=project)
34 alerts_view = alerts.AlertsView(mr)
35 self.assertEqual(ezt.boolean(False), alerts_view.show)
36
37 mr = testing_helpers.MakeMonorailRequest(
38 path='/p/testproj/?updated=10', project=project)
39 alerts_view = alerts.AlertsView(mr)
40 self.assertEqual(ezt.boolean(False), alerts_view.show)
41
42
43 if __name__ == '__main__':
44 unittest.main()
OLDNEW
« 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