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

Unified Diff: appengine/monorail/features/test/cues_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/features/test/cues_test.py
diff --git a/appengine/monorail/features/test/cues_test.py b/appengine/monorail/features/test/cues_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c11b472423ccd6508bf8715c275fa3674c0700f
--- /dev/null
+++ b/appengine/monorail/features/test/cues_test.py
@@ -0,0 +1,36 @@
+# 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
+
+"""Unittest for the cues module."""
+
+import unittest
+
+from features import cues
+from services import service_manager
+from testing import fake
+from testing import testing_helpers
+
+
+class CuesTest(unittest.TestCase):
+
+ def setUp(self):
+ self.services = service_manager.Services(
+ user=fake.UserService())
+ self.servlet = cues.SetCuesFeed('req', 'res', services=self.services)
+ self.services.user.TestAddUser('a@example.com', 111L)
+
+ def testHandleRequest(self):
+ _request, mr = testing_helpers.GetRequestObjects(
+ path='/hosting/cues?cue_id=42', user_info={'user_id': 111L})
+
+ self.servlet.HandleRequest(mr)
+ user = self.services.user.test_users[111L]
+ self.assertTrue(user is not None)
+ dismissed_cues = user.dismissed_cues
+ self.assertTrue(dismissed_cues is not None)
+ self.assertIn('42', dismissed_cues)
+ self.assertNotIn('1492', dismissed_cues)
+
+

Powered by Google App Engine
This is Rietveld 408576698