Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # Copyright 2016 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 service_manager module.""" |
| 7 | from __future__ import print_function |
| 8 | from __future__ import division |
| 9 | from __future__ import absolute_import |
| 10 | |
| 11 | import unittest |
| 12 | |
| 13 | from features import autolink |
| 14 | from services import cachemanager_svc |
| 15 | from services import config_svc |
| 16 | from services import features_svc |
| 17 | from services import issue_svc |
| 18 | from services import service_manager |
| 19 | from services import project_svc |
| 20 | from services import star_svc |
| 21 | from services import user_svc |
| 22 | from services import usergroup_svc |
| 23 | |
| 24 | |
| 25 | class ServiceManagerTest(unittest.TestCase): |
| 26 | |
| 27 | def testSetUpServices(self): |
| 28 | svcs = service_manager.set_up_services() |
| 29 | self.assertIsInstance(svcs, service_manager.Services) |
| 30 | self.assertIsInstance(svcs.autolink, autolink.Autolink) |
| 31 | self.assertIsInstance(svcs.cache_manager, cachemanager_svc.CacheManager) |
| 32 | self.assertIsInstance(svcs.user, user_svc.UserService) |
| 33 | self.assertIsInstance(svcs.user_star, star_svc.UserStarService) |
| 34 | self.assertIsInstance(svcs.project_star, star_svc.ProjectStarService) |
| 35 | self.assertIsInstance(svcs.issue_star, star_svc.IssueStarService) |
| 36 | self.assertIsInstance(svcs.project, project_svc.ProjectService) |
| 37 | self.assertIsInstance(svcs.usergroup, usergroup_svc.UserGroupService) |
| 38 | self.assertIsInstance(svcs.config, config_svc.ConfigService) |
| 39 | self.assertIsInstance(svcs.issue, issue_svc.IssueService) |
| 40 | self.assertIsInstance(svcs.features, features_svc.FeaturesService) |
| 41 | |
| 42 | # Calling it again should give the same object |
| 43 | svcs2 = service_manager.set_up_services() |
| 44 | self.assertTrue(svcs is svcs2) |