Coverage for manila/tests/common/test_config.py: 100%
21 statements
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
« prev ^ index » next coverage.py v7.11.0, created at 2026-02-18 22:19 +0000
1# Copyright 2015 Mirantis Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
16import ddt
18from manila.common import config
19from manila.common import constants
20from manila import exception
21from manila import test
22from manila.tests import utils as test_utils
24VALID_CASES = [proto.lower() for proto in constants.SUPPORTED_SHARE_PROTOCOLS]
25VALID_CASES.extend([proto.upper() for proto in VALID_CASES])
26VALID_CASES.append(','.join(case for case in VALID_CASES))
29@ddt.ddt
30class VerifyConfigShareProtocolsTestCase(test.TestCase):
32 @ddt.data(*VALID_CASES)
33 def test_verify_share_protocols_valid_cases(self, proto):
34 data = dict(DEFAULT=dict(enabled_share_protocols=proto))
35 with test_utils.create_temp_config_with_opts(data):
36 config.verify_share_protocols()
38 @ddt.data(None, '', 'fake', [], ['fake'], [VALID_CASES[0] + 'fake'])
39 def test_verify_share_protocols_invalid_cases(self, proto):
40 data = dict(DEFAULT=dict(enabled_share_protocols=proto))
41 with test_utils.create_temp_config_with_opts(data):
42 self.assertRaises(
43 exception.ManilaException, config.verify_share_protocols)