Adrià Vilanova MartÃnez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | # Copyright 2016 The Chromium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | |
| 5 | """Tests for the service_manager module.""" |
| 6 | from __future__ import print_function |
| 7 | from __future__ import division |
| 8 | from __future__ import absolute_import |
| 9 | |
| 10 | import unittest |
| 11 | |
| 12 | from features import autolink |
| 13 | from services import cachemanager_svc |
| 14 | from services import config_svc |
| 15 | from services import features_svc |
| 16 | from services import issue_svc |
| 17 | from services import service_manager |
| 18 | from services import project_svc |
| 19 | from services import star_svc |
| 20 | from services import user_svc |
| 21 | from services import usergroup_svc |
| 22 | |
| 23 | |
| 24 | class ServiceManagerTest(unittest.TestCase): |
| 25 | |
| 26 | def testSetUpServices(self): |
| 27 | svcs = service_manager.set_up_services() |
| 28 | self.assertIsInstance(svcs, service_manager.Services) |
| 29 | self.assertIsInstance(svcs.autolink, autolink.Autolink) |
| 30 | self.assertIsInstance(svcs.cache_manager, cachemanager_svc.CacheManager) |
| 31 | self.assertIsInstance(svcs.user, user_svc.UserService) |
| 32 | self.assertIsInstance(svcs.user_star, star_svc.UserStarService) |
| 33 | self.assertIsInstance(svcs.project_star, star_svc.ProjectStarService) |
| 34 | self.assertIsInstance(svcs.issue_star, star_svc.IssueStarService) |
| 35 | self.assertIsInstance(svcs.project, project_svc.ProjectService) |
| 36 | self.assertIsInstance(svcs.usergroup, usergroup_svc.UserGroupService) |
| 37 | self.assertIsInstance(svcs.config, config_svc.ConfigService) |
| 38 | self.assertIsInstance(svcs.issue, issue_svc.IssueService) |
| 39 | self.assertIsInstance(svcs.features, features_svc.FeaturesService) |
| 40 | |
| 41 | # Calling it again should give the same object |
| 42 | svcs2 = service_manager.set_up_services() |
| 43 | self.assertTrue(svcs is svcs2) |