OLD | NEW |
(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 """Unittest for the cues module.""" |
| 7 |
| 8 import unittest |
| 9 |
| 10 from features import cues |
| 11 from services import service_manager |
| 12 from testing import fake |
| 13 from testing import testing_helpers |
| 14 |
| 15 |
| 16 class CuesTest(unittest.TestCase): |
| 17 |
| 18 def setUp(self): |
| 19 self.services = service_manager.Services( |
| 20 user=fake.UserService()) |
| 21 self.servlet = cues.SetCuesFeed('req', 'res', services=self.services) |
| 22 self.services.user.TestAddUser('a@example.com', 111L) |
| 23 |
| 24 def testHandleRequest(self): |
| 25 _request, mr = testing_helpers.GetRequestObjects( |
| 26 path='/hosting/cues?cue_id=42', user_info={'user_id': 111L}) |
| 27 |
| 28 self.servlet.HandleRequest(mr) |
| 29 user = self.services.user.test_users[111L] |
| 30 self.assertTrue(user is not None) |
| 31 dismissed_cues = user.dismissed_cues |
| 32 self.assertTrue(dismissed_cues is not None) |
| 33 self.assertIn('42', dismissed_cues) |
| 34 self.assertNotIn('1492', dismissed_cues) |
| 35 |
| 36 |
OLD | NEW |