Merge "Test classes for lookup plugins"

This commit is contained in:
Zuul 2021-05-17 17:09:14 +00:00 committed by Gerrit Code Review
commit c34f773b0b
10 changed files with 335 additions and 0 deletions

View File

@ -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],

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()