def test_find_resource_managers(self, mock_itersubclasses): mock_itersubclasses.return_value = [ self._get_res_mock(_service="fake", _resource="1", _order=1, _admin_required=True), self._get_res_mock(_service="fake", _resource="2", _order=3, _admin_required=False), self._get_res_mock(_service="other", _resource="2", _order=2, _admin_required=False) ] self.assertEqual(mock_itersubclasses.return_value[0:2], manager.find_resource_managers(names=["fake"])) self.assertEqual(mock_itersubclasses.return_value[0:1], manager.find_resource_managers(names=["fake.1"])) self.assertEqual( [mock_itersubclasses.return_value[0], mock_itersubclasses.return_value[2], mock_itersubclasses.return_value[1]], manager.find_resource_managers(names=["fake", "other"])) self.assertEqual(mock_itersubclasses.return_value[0:1], manager.find_resource_managers(names=["fake"], admin_required=True)) self.assertEqual(mock_itersubclasses.return_value[1:2], manager.find_resource_managers(names=["fake"], admin_required=False))