Test classes for lookup plugins
Extra imports are mocked and fakes.py is imported in every test module. This should prevent requirements bloat, along with associated gate issues. Closes-Bug: #1922726 Change-Id: I73991977005838ae7c5eaf59e5456f9c92811d67
This commit is contained in:
parent
cee36599e1
commit
30fc68853d
|
@ -20,6 +20,9 @@ except ImportError:
|
|||
|
||||
sys.modules['uuidutils'] = mock.MagicMock()
|
||||
sys.modules['xml.etree'] = mock.MagicMock()
|
||||
sys.modules['glanceclient.exc'] = mock.MagicMock()
|
||||
sys.modules['ironic_inspector_client'] = mock.MagicMock()
|
||||
sys.modules['novaclient.exceptions'] = mock.MagicMock()
|
||||
|
||||
MOCK_CPUS_RET_VALUE = (
|
||||
[0, 1],
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_glance_images
|
||||
-----------------------------
|
||||
|
||||
Tests for `glance_images` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.glance_images as plugin
|
||||
|
||||
|
||||
class TestGlanceImages(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestGlanceImages, self).setUp()
|
|
@ -0,0 +1,36 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_introspection_data
|
||||
-----------------------------
|
||||
|
||||
Tests for `introspection_data` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
import lookup_plugins.introspection_data as plugin
|
||||
|
||||
|
||||
class TestIntrospectionData(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIntrospectionData, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_ironic_nodes
|
||||
-----------------------------
|
||||
|
||||
Tests for `ironic_nodes` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.ironic_nodes as plugin
|
||||
|
||||
|
||||
class TestIronicNodes(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestIronicNodes, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_nova_flavors
|
||||
-----------------------------
|
||||
|
||||
Tests for `nova_flavors` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.nova_flavors as plugin
|
||||
|
||||
|
||||
class TestNovaFlavors(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNovaFlavors, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_nova_hypervisor_statistics
|
||||
-----------------------------
|
||||
|
||||
Tests for `nova_hypervisor_statistics` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.nova_hypervisor_statistics as plugin
|
||||
|
||||
|
||||
class TestNovaHypersvisorStatistics(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNovaHypersvisorStatistics, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_nova_servers
|
||||
-----------------------------
|
||||
|
||||
Tests for `nova_servers` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.nova_servers as plugin
|
||||
|
||||
|
||||
class TestNovaServers(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestNovaServers, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_roles_info
|
||||
-----------------------------
|
||||
|
||||
Tests for `roles_info` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.roles_info as plugin
|
||||
|
||||
|
||||
class TestRolesInfo(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestRolesInfo, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2021 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_stack_resources
|
||||
-----------------------------
|
||||
|
||||
Tests for `stack_resources` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.stack_resources as plugin
|
||||
|
||||
|
||||
class TestStackResources(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestStackResources, self).setUp()
|
|
@ -0,0 +1,37 @@
|
|||
# Copyright 2017 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_tht
|
||||
-----------------------------
|
||||
|
||||
Tests for `tht` module.
|
||||
"""
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
from tripleo_validations.tests import fakes
|
||||
from tripleo_validations.tests import base
|
||||
|
||||
import lookup_plugins.tht as plugin
|
||||
|
||||
|
||||
class TestTht(base.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestTht, self).setUp()
|
Loading…
Reference in New Issue