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
18 from crl.remotesession.remotesession import RemoteSession
19 from hostcli import HostCli
20 from .clusterverifier import (
24 from .userverifier import UserVerifier
25 from .envcreatorverifier import EnvCreatorVerifier
27 from . import usermanager
28 from .envcreator import EnvCreator
31 @pytest.fixture(params=[Type1Verifier,
33 def clusterverifier(request, clustermocks):
34 return request.param(clustermocks)
38 def clustermocks(mock_remotesession, mock_hostcli, mock_envcreator, mock_usermanager):
39 return ClusterMocks(remotesession=mock_remotesession,
41 envcreator=mock_envcreator,
42 usermanager=mock_usermanager)
46 def mock_remotesession():
47 with mock.patch.object(cluster,
49 mock.create_autospec(RemoteSession)) as p:
55 with mock.patch.object(cluster,
57 mock.create_autospec(HostCli)) as p:
62 def mock_envcreator():
63 with mock.patch.object(cluster,
65 mock.create_autospec(EnvCreator)) as p:
70 def mock_usermanager():
71 with mock.patch.object(cluster,
73 mock.create_autospec(usermanager.UserManager)) as p:
77 @pytest.fixture(params=['Role', 'Role-Name'])
78 def userverifier(request):
79 return UserVerifier(role_attr=request.param)
83 def envcreatorverifier():
84 return EnvCreatorVerifier()