3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # pylint: disable=redefined-outer-name
16 from collections import namedtuple
19 from .openstackcli import (
24 from .cloudcli import (
34 CLIWRAPPER_CLSES = [DefaultCloud,
41 CLI_CLSES = [OpenStack, Runner]
44 class WrapperCliTuple(namedtuple('WrapperCliTuple', ['wrapper', 'cli'])):
48 @pytest.fixture(params=[WrapperCliTuple(wrapper=cliw, cli=clicls)
49 for clicls in CLI_CLSES
50 for cliw in CLIWRAPPER_CLSES])
51 def cliwrapper(mock_remotesession, request):
52 c = request.param.wrapper(request.param.cli)
53 c.set_remotesession(mock_remotesession)
58 class MethodFmt(namedtuple('MethodFormat', ['method', 'fmt'])):
62 @pytest.fixture(params=['run', 'run_ignore_output'])
63 def methodfmt(request, openstack):
65 'run': MethodFmt(openstack.run, ' -f json'),
66 'run_ignore_output': MethodFmt(openstack.run_ignore_output, '')}[