Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame^] | 1 | # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed 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 the warmup servlet.""" |
| 7 | from __future__ import print_function |
| 8 | from __future__ import division |
| 9 | from __future__ import absolute_import |
| 10 | |
| 11 | import unittest |
| 12 | |
| 13 | from testing import testing_helpers |
| 14 | |
| 15 | from framework import sql |
| 16 | from framework import warmup |
| 17 | from services import service_manager |
| 18 | |
| 19 | |
| 20 | class WarmupTest(unittest.TestCase): |
| 21 | |
| 22 | def setUp(self): |
| 23 | #self.cache_manager = cachemanager_svc.CacheManager() |
| 24 | #self.services = service_manager.Services( |
| 25 | # cache_manager=self.cache_manager) |
| 26 | self.services = service_manager.Services() |
| 27 | self.servlet = warmup.Warmup( |
| 28 | 'req', 'res', services=self.services) |
| 29 | |
| 30 | |
| 31 | def testHandleRequest_NothingToDo(self): |
| 32 | mr = testing_helpers.MakeMonorailRequest() |
| 33 | actual_json_data = self.servlet.HandleRequest(mr) |
| 34 | self.assertEqual( |
| 35 | {'success': 1}, |
| 36 | actual_json_data) |