Coverage for manila/tests/cmd/test_data.py: 100%
23 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, Hitachi Data Systems.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
15import sys
17from manila.cmd import data as manila_data
18from manila import test
19from manila import version
21CONF = manila_data.CONF
24class ManilaCmdDataTestCase(test.TestCase):
26 def test_main(self):
27 sys.argv = ['manila-data']
28 self.mock_object(manila_data.log, 'setup')
29 self.mock_object(manila_data.log, 'register_options')
30 self.mock_object(manila_data.utils, 'monkey_patch')
31 self.mock_object(manila_data.service.Service, 'create')
32 self.mock_object(manila_data.service, 'serve')
33 self.mock_object(manila_data.service, 'wait')
35 manila_data.main()
37 self.assertEqual('manila', CONF.project)
38 self.assertEqual(version.version_string(), CONF.version)
39 manila_data.log.setup.assert_called_once_with(CONF, "manila")
40 manila_data.log.register_options.assert_called_once_with(CONF)
41 manila_data.utils.monkey_patch.assert_called_once_with()
42 manila_data.service.Service.create.assert_called_once_with(
43 binary='manila-data')
44 manila_data.service.wait.assert_called_once_with()
45 manila_data.service.serve.assert_called_once_with(
46 manila_data.service.Service.create.return_value)