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

Unified Diff: Tools/GardeningServer/internal_alerts_test.py

Issue 633983002: Implemented retrieval of alerts history (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Lowered MAX_LIMIT_PER_PAGE because it was generating too large response for AE Created 6 years, 2 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
« no previous file with comments | « Tools/GardeningServer/internal_alerts.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/GardeningServer/internal_alerts_test.py
diff --git a/Tools/GardeningServer/internal_alerts_test.py b/Tools/GardeningServer/internal_alerts_test.py
index c771eb0896e08477621cb8860693bcccf2a0cfc5..d78baf5df6a61a9a0aa0f7f44cf46c4013fa882b 100644
--- a/Tools/GardeningServer/internal_alerts_test.py
+++ b/Tools/GardeningServer/internal_alerts_test.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import alerts
import internal_alerts
import json
import random
@@ -80,6 +81,27 @@ class InternalAlertsTest(unittest.TestCase):
internal_alerts = json.loads(res.body)
self.assertEqual(internal_alerts['alerts'], 'everything is OK')
+ def test_internal_alerts_stored_in_history_have_correct_type(self):
+ test_alerts1 = {'alerts': ['hello', 'world', '1']}
+ test_alerts2 = {'alerts': ['hello', 'world', '2']}
+ self.testapp.post('/internal-alerts',
+ {'content': json.dumps(test_alerts1)})
+ self.testapp.post('/internal-alerts',
+ {'content': json.dumps(test_alerts2)})
+ alerts_query = alerts.AlertsJSON.query().order(alerts.AlertsJSON.date)
+ stored_alerts = alerts_query.fetch(limit=3)
+ self.assertEqual(2, len(stored_alerts))
+ self.assertEqual(stored_alerts[0].type, 'internal-alerts')
+ self.assertEqual(stored_alerts[1].type, 'internal-alerts')
+
+ def test_internal_alerts_same_as_last_alerts_are_added_to_history(self):
+ test_alerts = {'alerts': ['hello', 'world']}
+ alerts.AlertsJSON(json=json.dumps(test_alerts), type='alerts').put()
+ self.testapp.post('/internal-alerts',
+ {'content': json.dumps(test_alerts)})
+ alerts_query = alerts.AlertsJSON.query()
+ self.assertEqual(2, alerts_query.count(limit=3))
+
def test_large_number_of_internal_alerts(self):
self.user_helper('tester@google.com', '123')
# This generates ~2.5MB of JSON that compresses to ~750K. Real
« no previous file with comments | « Tools/GardeningServer/internal_alerts.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698