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

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: Refactored code and added tests 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
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..e635ccc9df6832cf46a2e22342813f8f07ca16ae 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,19 @@ 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_key(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].key, 'internal-alerts')
+ self.assertEqual(stored_alerts[1].key, 'internal-alerts')
+
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
« Tools/GardeningServer/alerts.py ('K') | « Tools/GardeningServer/internal_alerts.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698