Update all test base classes to use base.TestCase

We have a centrally defined test case base class that handles a set of
things like log capture, mocking time.sleep and setting up
requests-mock.

We also had a split base test case, with some things using TestCase and
some using RequestsMockTestCase. This was a holdover from the transition
to requests-mock. We are finally at the point where we don't need the
split, so merge TestCase and RequestsMockTest case.

Then, update all of the tests to use the new combined base class.

Also, replace a use of unittest.skipTest with self.skipTest from the
base class.

Change-Id: I2cc3e201a5241262e5d102d3de8423c4fb2a8c4a
This commit is contained in:
Monty Taylor 2018-02-02 06:45:29 -06:00
parent 18a178456c
commit 1b43673c04
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
217 changed files with 430 additions and 444 deletions

View File

@ -7,8 +7,8 @@ http://docs.openstack.org/developer/hacking/
Indentation
-----------
PEP-8 allows for 'visual' indentation. Do not use it. Visual indentation looks
like this:
PEP-8 allows for 'visual' indentation. **Do not use it**.
Visual indentation looks like this:
.. code-block:: python
@ -25,9 +25,10 @@ Instead of visual indentation, use this:
arg1, arg1, arg3, arg4)
That way, if some_method ever needs to be renamed, the only line that needs
to be touched is the line with some_method. Additionaly, if you need to
line break at the top of a block, please indent the continuation line
an additional 4 spaces, like this:
to be touched is the line with some_method.
Additionaly, if you need to line break at the top of a block, please indent
the continuation line an additional 4 spaces, like this:
.. code-block:: python
@ -44,6 +45,9 @@ Unit Tests
Unit tests should be virtually instant. If a unit test takes more than 1 second
to run, it is a bad unit test. Honestly, 1 second is too slow.
All unit test classes should subclass `openstack.tests.unit.base.BaseTestCase`. The
base TestCase class takes care of properly creating `OpenStackCloud` objects
All unit test classes should subclass `openstack.tests.unit.base.TestCase`. The
base TestCase class takes care of properly creating `Connection` objects
in a way that protects against local environment.
Test cases should use requests-mock to mock out HTTP interactions rather than
using mock to mock out object access.

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from examples.compute import create
from examples.compute import delete
@ -21,7 +21,7 @@ from examples.network import find as network_find
from examples.network import list as network_list
class TestCompute(testtools.TestCase):
class TestCompute(base.TestCase):
"""Test the compute examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from examples import connect
from examples.identity import list as identity_list
class TestIdentity(testtools.TestCase):
class TestIdentity(base.TestCase):
"""Test the identity examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from examples import connect
from examples.image import create as image_create
@ -18,7 +18,7 @@ from examples.image import delete as image_delete
from examples.image import list as image_list
class TestImage(testtools.TestCase):
class TestImage(base.TestCase):
"""Test the image examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from examples import connect
from examples.network import create as network_create
@ -19,7 +19,7 @@ from examples.network import find as network_find
from examples.network import list as network_list
class TestNetwork(testtools.TestCase):
class TestNetwork(base.TestCase):
"""Test the network examples
The purpose of these tests is to ensure the examples run without erring

View File

@ -10,15 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import unittest
from openstack import exceptions
from openstack.orchestration.v1 import stack
from openstack.tests.functional import base
from openstack.tests.functional.network.v2 import test_network
@unittest.skip("bug/1525005")
class TestStack(base.BaseFunctionalTest):
NAME = 'test_stack'
@ -29,6 +26,9 @@ class TestStack(base.BaseFunctionalTest):
def setUp(self):
super(TestStack, self).setUp()
self.skipTest(
'Orchestration functional tests disabled:'
' https://bugs.launchpad.net/python-openstacksdk/+bug/1525005')
self.require_service('orchestration')
if self.conn.compute.find_keypair(self.NAME) is None:

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal import baremetal_service
class TestBaremetalService(testtools.TestCase):
class TestBaremetalService(base.TestCase):
def test_service(self):
sot = baremetal_service.BaremetalService()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal import version
@ -23,7 +23,7 @@ EXAMPLE = {
}
class TestVersion(testtools.TestCase):
class TestVersion(base.TestCase):
def test_basic(self):
sot = version.Version()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import chassis
@ -43,7 +43,7 @@ FAKE = {
}
class TestChassis(testtools.TestCase):
class TestChassis(base.TestCase):
def test_basic(self):
sot = chassis.Chassis()
@ -69,7 +69,7 @@ class TestChassis(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestChassisDetail(testtools.TestCase):
class TestChassisDetail(base.TestCase):
def test_basic(self):
sot = chassis.ChassisDetail()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import driver
@ -43,7 +43,7 @@ FAKE = {
}
class TestDriver(testtools.TestCase):
class TestDriver(base.TestCase):
def test_basic(self):
sot = driver.Driver()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import node
@ -91,7 +91,7 @@ FAKE = {
}
class TestNode(testtools.TestCase):
class TestNode(base.TestCase):
def test_basic(self):
sot = node.Node()
@ -145,7 +145,7 @@ class TestNode(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestNodeDetail(testtools.TestCase):
class TestNodeDetail(base.TestCase):
def test_basic(self):
sot = node.NodeDetail()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import port
@ -42,7 +42,7 @@ FAKE = {
}
class TestPort(testtools.TestCase):
class TestPort(base.TestCase):
def test_basic(self):
sot = port.Port()
@ -73,7 +73,7 @@ class TestPort(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestPortDetail(testtools.TestCase):
class TestPortDetail(base.TestCase):
def test_basic(self):
sot = port.PortDetail()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.baremetal.v1 import port_group
@ -47,7 +47,7 @@ FAKE = {
}
class TestPortGroup(testtools.TestCase):
class TestPortGroup(base.TestCase):
def test_basic(self):
sot = port_group.PortGroup()
@ -78,7 +78,7 @@ class TestPortGroup(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestPortGroupDetail(testtools.TestCase):
class TestPortGroupDetail(base.TestCase):
def test_basic(self):
sot = port_group.PortGroupDetail()

View File

@ -18,7 +18,6 @@ import time
import uuid
import fixtures
import mock
import os
import openstack.config as occ
from requests import structures
@ -81,12 +80,12 @@ _RoleData = collections.namedtuple(
'role_id, role_name, json_response, json_request')
class BaseTestCase(base.TestCase):
class TestCase(base.TestCase):
def setUp(self, cloud_config_fixture='clouds.yaml'):
"""Run before each test method to initialize test environment."""
super(BaseTestCase, self).setUp()
super(TestCase, self).setUp()
# Sleeps are for real testing, but unit tests shouldn't need them
realsleep = time.sleep
@ -99,7 +98,7 @@ class BaseTestCase(base.TestCase):
_nosleep))
self.fixtures_directory = 'openstack/tests/unit/fixtures'
# Isolate os-client-config from test environment
# Isolate openstack.config from test environment
config = tempfile.NamedTemporaryFile(delete=False)
cloud_path = '%s/clouds/%s' % (self.fixtures_directory,
cloud_config_fixture)
@ -126,28 +125,6 @@ class BaseTestCase(base.TestCase):
config=self.cloud_config,
strict=True)
# TODO(shade) Remove this and rename RequestsMockTestCase to TestCase.
# There are still a few places, like test_normalize, that assume
# this mocking is in place rather than having the correct
# requests_mock entries set up that need to be converted.
class TestCase(BaseTestCase):
def setUp(self, cloud_config_fixture='clouds.yaml'):
super(TestCase, self).setUp(cloud_config_fixture=cloud_config_fixture)
self.session_fixture = self.useFixture(fixtures.MonkeyPatch(
'openstack.config.cloud_region.CloudRegion.get_session',
mock.Mock()))
class RequestsMockTestCase(BaseTestCase):
def setUp(self, cloud_config_fixture='clouds.yaml'):
super(RequestsMockTestCase, self).setUp(
cloud_config_fixture=cloud_config_fixture)
# FIXME(notmorgan): Convert the uri_registry, discovery.json, and
# use of keystone_v3/v2 to a proper fixtures.Fixture. For now this
# is acceptable, but eventually this should become it's own fixture
@ -653,7 +630,7 @@ class RequestsMockTestCase(BaseTestCase):
len(self.calls), len(self.adapter.request_history))
class IronicTestCase(RequestsMockTestCase):
class IronicTestCase(TestCase):
def setUp(self):
super(IronicTestCase, self).setUp()

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.block_storage import block_storage_service
class TestBlockStorageService(testtools.TestCase):
class TestBlockStorageService(base.TestCase):
def test_service(self):
sot = block_storage_service.BlockStorageService()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.block_storage.v2 import snapshot
@ -38,7 +38,7 @@ DETAILED_SNAPSHOT = SNAPSHOT.copy()
DETAILED_SNAPSHOT.update(**DETAILS)
class TestSnapshot(testtools.TestCase):
class TestSnapshot(base.TestCase):
def test_basic(self):
sot = snapshot.Snapshot(SNAPSHOT)
@ -72,7 +72,7 @@ class TestSnapshot(testtools.TestCase):
self.assertTrue(sot.is_forced)
class TestSnapshotDetail(testtools.TestCase):
class TestSnapshotDetail(base.TestCase):
def test_basic(self):
sot = snapshot.SnapshotDetail(DETAILED_SNAPSHOT)

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.block_storage.v2 import type
@ -24,7 +24,7 @@ TYPE = {
}
class TestType(testtools.TestCase):
class TestType(base.TestCase):
def test_basic(self):
sot = type.Type(**TYPE)

View File

@ -12,7 +12,7 @@
import copy
import testtools
from openstack.tests.unit import base
from openstack.block_storage.v2 import volume
@ -61,7 +61,7 @@ VOLUME_DETAIL = copy.copy(VOLUME)
VOLUME_DETAIL.update(DETAILS)
class TestVolume(testtools.TestCase):
class TestVolume(base.TestCase):
def test_basic(self):
sot = volume.Volume(VOLUME)
@ -102,7 +102,7 @@ class TestVolume(testtools.TestCase):
self.assertEqual(VOLUME["imageRef"], sot.image_id)
class TestVolumeDetail(testtools.TestCase):
class TestVolumeDetail(base.TestCase):
def test_basic(self):
sot = volume.VolumeDetail(VOLUME_DETAIL)

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.block_storage.v2 import stats
@ -28,7 +28,7 @@ POOLS = {"name": "pool1",
}
class TestBackendPools(testtools.TestCase):
class TestBackendPools(base.TestCase):
def setUp(self):
super(TestBackendPools, self).setUp()

View File

@ -14,7 +14,7 @@ from openstack.tests.unit import base
from openstack.tests import fakes
class TestAggregate(base.RequestsMockTestCase):
class TestAggregate(base.TestCase):
def setUp(self):
super(TestAggregate, self).setUp()

View File

@ -36,7 +36,7 @@ _fake_zone_list = {
}
class TestAvailabilityZoneNames(base.RequestsMockTestCase):
class TestAvailabilityZoneNames(base.TestCase):
def test_list_availability_zone_names(self):
self.register_uris([

View File

@ -92,7 +92,7 @@ _TASK_SCHEMA = dict(
)
class TestMemoryCache(base.RequestsMockTestCase):
class TestMemoryCache(base.TestCase):
def setUp(self):
super(TestMemoryCache, self).setUp(

View File

@ -49,7 +49,7 @@ cluster_template_obj = munch.Munch(
)
class TestClusterTemplates(base.RequestsMockTestCase):
class TestClusterTemplates(base.TestCase):
def test_list_cluster_templates_without_detail(self):

View File

@ -28,7 +28,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestCreateServer(base.RequestsMockTestCase):
class TestCreateServer(base.TestCase):
def test_create_server_with_get_exception(self):
"""

View File

@ -23,7 +23,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestCreateVolumeSnapshot(base.RequestsMockTestCase):
class TestCreateVolumeSnapshot(base.TestCase):
def test_create_volume_snapshot_wait(self):
"""

View File

@ -23,7 +23,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestDeleteServer(base.RequestsMockTestCase):
class TestDeleteServer(base.TestCase):
def test_delete_server(self):
"""

View File

@ -23,7 +23,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestDeleteVolumeSnapshot(base.RequestsMockTestCase):
class TestDeleteVolumeSnapshot(base.TestCase):
def test_delete_volume_snapshot(self):
"""

View File

@ -22,7 +22,7 @@ import openstack.cloud
from openstack.tests.unit import base
class TestDomains(base.RequestsMockTestCase):
class TestDomains(base.TestCase):
def get_mock_url(self, service_type='identity',
interface='admin', resource='domains',

View File

@ -27,7 +27,7 @@ from openstack.tests.unit import base
from testtools import matchers
class TestCloudEndpoints(base.RequestsMockTestCase):
class TestCloudEndpoints(base.TestCase):
def get_mock_url(self, service_type='identity', interface='admin',
resource='endpoints', append=None, base_url_append='v3'):

View File

@ -16,7 +16,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestFlavors(base.RequestsMockTestCase):
class TestFlavors(base.TestCase):
def test_create_flavor(self):

View File

@ -28,7 +28,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestFloatingIP(base.RequestsMockTestCase):
class TestFloatingIP(base.TestCase):
mock_floating_ip_list_rep = {
'floatingips': [
{

View File

@ -31,7 +31,7 @@ def get_fake_has_service(has_service):
return fake_has_service
class TestFloatingIP(base.RequestsMockTestCase):
class TestFloatingIP(base.TestCase):
mock_floating_ip_list_rep = [
{
'fixed_ip': None,

View File

@ -24,7 +24,7 @@ from openstack.tests.unit import base
from openstack.tests import fakes
class TestFloatingIPPool(base.RequestsMockTestCase):
class TestFloatingIPPool(base.TestCase):
pools = [{'name': u'public'}]
def test_list_floating_ip_pools(self):

View File

@ -14,7 +14,7 @@
from openstack.tests.unit import base
class TestGroups(base.RequestsMockTestCase):
class TestGroups(base.TestCase):
def setUp(self, cloud_config_fixture='clouds.yaml'):
super(TestGroups, self).setUp(
cloud_config_fixture=cloud_config_fixture)

View File

@ -34,7 +34,7 @@ RAW_ROLE_ASSIGNMENTS = [
]
class TestIdentityRoles(base.RequestsMockTestCase):
class TestIdentityRoles(base.TestCase):
def get_mock_url(self, service_type='identity', interface='admin',
resource='roles', append=None, base_url_append='v3',

View File

@ -34,7 +34,7 @@ from openstack.tests.unit import base
CINDER_URL = 'https://volume.example.com/v2/1c36b64c840a42cd9e9b931a369337f0'
class BaseTestImage(base.RequestsMockTestCase):
class BaseTestImage(base.TestCase):
def setUp(self):
super(BaseTestImage, self).setUp()
@ -929,7 +929,7 @@ class TestImageSuburl(BaseTestImage):
self.assert_calls()
class TestImageV1Only(base.RequestsMockTestCase):
class TestImageV1Only(base.TestCase):
def setUp(self):
super(TestImageV1Only, self).setUp()
@ -955,7 +955,7 @@ class TestImageV1Only(base.RequestsMockTestCase):
self.assertFalse(self.cloud._is_client_version('image', 2))
class TestImageV2Only(base.RequestsMockTestCase):
class TestImageV2Only(base.TestCase):
def setUp(self):
super(TestImageV2Only, self).setUp()
@ -1049,7 +1049,7 @@ class TestImageVolume(BaseTestImage):
self.assert_calls()
class TestImageBrokenDiscovery(base.RequestsMockTestCase):
class TestImageBrokenDiscovery(base.TestCase):
def setUp(self):
super(TestImageBrokenDiscovery, self).setUp()

View File

@ -19,7 +19,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestImageSnapshot(base.RequestsMockTestCase):
class TestImageSnapshot(base.TestCase):
def setUp(self):
super(TestImageSnapshot, self).setUp()

View File

@ -17,7 +17,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestKeypair(base.RequestsMockTestCase):
class TestKeypair(base.TestCase):
def setUp(self):
super(TestKeypair, self).setUp()

View File

@ -13,7 +13,7 @@
from openstack.tests.unit import base
class TestLimits(base.RequestsMockTestCase):
class TestLimits(base.TestCase):
def test_get_compute_limits(self):
self.register_uris([

View File

@ -26,7 +26,7 @@ magnum_service_obj = dict(
)
class TestMagnumServices(base.RequestsMockTestCase):
class TestMagnumServices(base.TestCase):
def test_list_magnum_services(self):
self.register_uris([dict(

View File

@ -228,7 +228,7 @@ OSIC_SUBNETS = [
]
class TestMeta(base.RequestsMockTestCase):
class TestMeta(base.TestCase):
def test_find_nova_addresses_key_name(self):
# Note 198.51.100.0/24 is TEST-NET-2 from rfc5737
addrs = {'public': [{'addr': '198.51.100.1', 'version': 4}],

View File

@ -18,7 +18,7 @@ import openstack.cloud
from openstack.tests.unit import base
class TestNetwork(base.RequestsMockTestCase):
class TestNetwork(base.TestCase):
mock_new_network_rep = {
'provider:physical_network': None,

View File

@ -11,6 +11,7 @@
# under the License.
import mock
import fixtures
from openstack.tests.unit import base
@ -178,9 +179,16 @@ RAW_FLAVOR_DICT = {
'vcpus': 8}
# TODO(shade) Convert this to RequestsMockTestCase
# TODO(shade) Convert this to TestCase
class TestUtils(base.TestCase):
def setUp(self):
super(TestUtils, self).setUp()
self.session_fixture = self.useFixture(fixtures.MonkeyPatch(
'openstack.config.cloud_region.CloudRegion.get_session',
mock.Mock()))
def test_normalize_flavors(self):
raw_flavor = RAW_FLAVOR_DICT.copy()
expected = {

View File

@ -22,7 +22,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class BaseTestObject(base.RequestsMockTestCase):
class BaseTestObject(base.TestCase):
def setUp(self):
super(BaseTestObject, self).setUp()

View File

@ -19,7 +19,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestOperatorCloud(base.RequestsMockTestCase):
class TestOperatorCloud(base.TestCase):
@mock.patch.object(cloud_region.CloudRegion, 'get_endpoint')
def test_get_session_endpoint_provided(self, fake_get_endpoint):

View File

@ -16,7 +16,7 @@ import openstack.cloud
from openstack.tests.unit import base
class TestOpenStackCloudOperatorNoAuth(base.RequestsMockTestCase):
class TestOpenStackCloudOperatorNoAuth(base.TestCase):
def setUp(self):
"""Setup Noauth OpenStackCloud tests
@ -25,7 +25,7 @@ class TestOpenStackCloudOperatorNoAuth(base.RequestsMockTestCase):
mechanism that enables Ironic noauth mode to be utilized with
Shade.
Uses base.RequestsMockTestCase instead of IronicTestCase because
Uses base.TestCase instead of IronicTestCase because
we need to do completely different things with discovery.
"""
super(TestOpenStackCloudOperatorNoAuth, self).setUp()

View File

@ -23,7 +23,7 @@ from openstack.cloud.exc import OpenStackCloudException
from openstack.tests.unit import base
class TestPort(base.RequestsMockTestCase):
class TestPort(base.TestCase):
mock_neutron_port_create_rep = {
'port': {
'status': 'DOWN',

View File

@ -18,7 +18,7 @@ import openstack.cloud._utils
from openstack.tests.unit import base
class TestProject(base.RequestsMockTestCase):
class TestProject(base.TestCase):
def get_mock_url(self, service_type='identity', interface='admin',
resource=None, append=None, base_url_append=None,

View File

@ -19,7 +19,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestQosBandwidthLimitRule(base.RequestsMockTestCase):
class TestQosBandwidthLimitRule(base.TestCase):
policy_name = 'qos test policy'
policy_id = '881d1bb7-a663-44c0-8f9f-ee2765b74486'

View File

@ -19,7 +19,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestQosDscpMarkingRule(base.RequestsMockTestCase):
class TestQosDscpMarkingRule(base.TestCase):
policy_name = 'qos test policy'
policy_id = '881d1bb7-a663-44c0-8f9f-ee2765b74486'

View File

@ -19,7 +19,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestQosMinimumBandwidthRule(base.RequestsMockTestCase):
class TestQosMinimumBandwidthRule(base.TestCase):
policy_name = 'qos test policy'
policy_id = '881d1bb7-a663-44c0-8f9f-ee2765b74486'

View File

@ -19,7 +19,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestQosPolicy(base.RequestsMockTestCase):
class TestQosPolicy(base.TestCase):
policy_name = 'qos test policy'
policy_id = '881d1bb7-a663-44c0-8f9f-ee2765b74486'

View File

@ -17,7 +17,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestQosRuleType(base.RequestsMockTestCase):
class TestQosRuleType(base.TestCase):
rule_type_name = "bandwidth_limit"

View File

@ -31,7 +31,7 @@ fake_quota_set = {
}
class TestQuotas(base.RequestsMockTestCase):
class TestQuotas(base.TestCase):
def setUp(self, cloud_config_fixture='clouds.yaml'):
super(TestQuotas, self).setUp(
cloud_config_fixture=cloud_config_fixture)

View File

@ -26,7 +26,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestRebuildServer(base.RequestsMockTestCase):
class TestRebuildServer(base.TestCase):
def setUp(self):
super(TestRebuildServer, self).setUp()

View File

@ -41,7 +41,7 @@ new_recordset['id'] = '1'
new_recordset['zone'] = recordset_zone
class TestRecordset(base.RequestsMockTestCase):
class TestRecordset(base.TestCase):
def setUp(self):
super(TestRecordset, self).setUp()

View File

@ -17,7 +17,7 @@ import testtools
from testtools import matchers
class TestRoleAssignment(base.RequestsMockTestCase):
class TestRoleAssignment(base.TestCase):
def _build_role_assignment_response(self, role_id, scope_type, scope_id,
entity_type, entity_id):

View File

@ -20,7 +20,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestRouter(base.RequestsMockTestCase):
class TestRouter(base.TestCase):
router_name = 'goofy'
router_id = '57076620-dcfb-42ed-8ad6-79ccb4a79ed2'

View File

@ -42,7 +42,7 @@ nova_grp_dict = fakes.make_fake_nova_security_group(
)
class TestSecurityGroups(base.RequestsMockTestCase):
class TestSecurityGroups(base.TestCase):
def setUp(self):
super(TestSecurityGroups, self).setUp()

View File

@ -17,7 +17,7 @@ from openstack.tests.unit import base
from openstack.tests import fakes
class TestServerConsole(base.RequestsMockTestCase):
class TestServerConsole(base.TestCase):
def setUp(self):
super(TestServerConsole, self).setUp()

View File

@ -24,7 +24,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestServerDeleteMetadata(base.RequestsMockTestCase):
class TestServerDeleteMetadata(base.TestCase):
def setUp(self):
super(TestServerDeleteMetadata, self).setUp()

View File

@ -17,7 +17,7 @@ from openstack.tests.unit import base
from openstack.tests import fakes
class TestServerGroup(base.RequestsMockTestCase):
class TestServerGroup(base.TestCase):
def setUp(self):
super(TestServerGroup, self).setUp()

View File

@ -24,7 +24,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestServerSetMetadata(base.RequestsMockTestCase):
class TestServerSetMetadata(base.TestCase):
def setUp(self):
super(TestServerSetMetadata, self).setUp()

View File

@ -25,7 +25,7 @@ from openstack.tests.unit import base
from testtools import matchers
class CloudServices(base.RequestsMockTestCase):
class CloudServices(base.TestCase):
def setUp(self, cloud_config_fixture='clouds.yaml'):
super(CloudServices, self).setUp(cloud_config_fixture)

View File

@ -32,7 +32,7 @@ RANGE_DATA = [
]
class TestShade(base.RequestsMockTestCase):
class TestShade(base.TestCase):
def setUp(self):
# This set of tests are not testing neutron, they're testing

View File

@ -16,5 +16,5 @@
from openstack.tests.unit import base
class TestShadeOperator(base.RequestsMockTestCase):
class TestShadeOperator(base.TestCase):
pass

View File

@ -20,7 +20,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestStack(base.RequestsMockTestCase):
class TestStack(base.TestCase):
def setUp(self):
super(TestStack, self).setUp()

View File

@ -20,7 +20,7 @@ from openstack.cloud import exc
from openstack.tests.unit import base
class TestSubnet(base.RequestsMockTestCase):
class TestSubnet(base.TestCase):
network_name = 'network_name'
subnet_name = 'subnet_name'

View File

@ -24,7 +24,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestUpdateServer(base.RequestsMockTestCase):
class TestUpdateServer(base.TestCase):
def setUp(self):
super(TestUpdateServer, self).setUp()

View File

@ -17,7 +17,7 @@ import uuid
from openstack.tests.unit import base
class TestUsage(base.RequestsMockTestCase):
class TestUsage(base.TestCase):
def test_get_usage(self):
project = self.mock_for_keystone_projects(project_count=1,

View File

@ -18,7 +18,7 @@ import openstack.cloud
from openstack.tests.unit import base
class TestUsers(base.RequestsMockTestCase):
class TestUsers(base.TestCase):
def _get_keystone_mock_url(self, resource, append=None, v3=True):
base_url_append = None

View File

@ -19,7 +19,7 @@ from openstack.tests import fakes
from openstack.tests.unit import base
class TestVolume(base.RequestsMockTestCase):
class TestVolume(base.TestCase):
def test_attach_volume(self):
server = dict(id='server001')

View File

@ -19,7 +19,7 @@ import openstack.cloud
from openstack.tests.unit import base
class TestVolumeAccess(base.RequestsMockTestCase):
class TestVolumeAccess(base.TestCase):
def test_list_volume_types(self):
volume_type = dict(
id='voltype01', description='volume type description',

View File

@ -13,7 +13,7 @@ from openstack.cloud import meta
from openstack.tests.unit import base
class TestVolumeBackups(base.RequestsMockTestCase):
class TestVolumeBackups(base.TestCase):
def test_search_volume_backups(self):
name = 'Volume1'
vol1 = {'name': name, 'availability_zone': 'az1'}

View File

@ -29,7 +29,7 @@ new_zone_dict = copy.copy(zone_dict)
new_zone_dict['id'] = '1'
class TestZone(base.RequestsMockTestCase):
class TestZone(base.TestCase):
def setUp(self):
super(TestZone, self).setUp()

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering import clustering_service
class TestClusteringService(testtools.TestCase):
class TestClusteringService(base.TestCase):
def test_service(self):
sot = clustering_service.ClusteringService()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering import version
@ -22,7 +22,7 @@ EXAMPLE = {
}
class TestVersion(testtools.TestCase):
class TestVersion(base.TestCase):
def test_basic(self):
sot = version.Version()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import action
@ -43,7 +43,7 @@ FAKE = {
}
class TestAction(testtools.TestCase):
class TestAction(base.TestCase):
def setUp(self):
super(TestAction, self).setUp()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import build_info
@ -25,7 +25,7 @@ FAKE = {
}
class TestBuildInfo(testtools.TestCase):
class TestBuildInfo(base.TestCase):
def setUp(self):
super(TestBuildInfo, self).setUp()

View File

@ -11,7 +11,7 @@
# under the License.
import mock
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import cluster
@ -65,7 +65,7 @@ FAKE_CREATE_RESP = {
}
class TestCluster(testtools.TestCase):
class TestCluster(base.TestCase):
def setUp(self):
super(TestCluster, self).setUp()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import cluster_attr as ca
@ -23,7 +23,7 @@ FAKE = {
}
class TestClusterAttr(testtools.TestCase):
class TestClusterAttr(base.TestCase):
def setUp(self):
super(TestClusterAttr, self).setUp()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import cluster_policy
@ -26,7 +26,7 @@ FAKE = {
}
class TestClusterPolicy(testtools.TestCase):
class TestClusterPolicy(base.TestCase):
def setUp(self):
super(TestClusterPolicy, self).setUp()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import event
@ -31,7 +31,7 @@ FAKE = {
}
class TestEvent(testtools.TestCase):
class TestEvent(base.TestCase):
def setUp(self):
super(TestEvent, self).setUp()

View File

@ -11,7 +11,7 @@
# under the License.
import mock
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import node
@ -37,7 +37,7 @@ FAKE = {
}
class TestNode(testtools.TestCase):
class TestNode(base.TestCase):
def test_basic(self):
sot = node.Node()
@ -156,7 +156,7 @@ class TestNode(testtools.TestCase):
sess.delete.assert_called_once_with(url, json=body)
class TestNodeDetail(testtools.TestCase):
class TestNodeDetail(base.TestCase):
def test_basic(self):
sot = node.NodeDetail()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import policy
@ -41,7 +41,7 @@ FAKE = {
}
class TestPolicy(testtools.TestCase):
class TestPolicy(base.TestCase):
def setUp(self):
super(TestPolicy, self).setUp()
@ -71,7 +71,7 @@ class TestPolicy(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestPolicyValidate(testtools.TestCase):
class TestPolicyValidate(base.TestCase):
def setUp(self):
super(TestPolicyValidate, self).setUp()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import policy_type
@ -29,7 +29,7 @@ FAKE = {
}
class TestPolicyType(testtools.TestCase):
class TestPolicyType(base.TestCase):
def test_basic(self):
sot = policy_type.PolicyType()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import profile
@ -41,7 +41,7 @@ FAKE = {
}
class TestProfile(testtools.TestCase):
class TestProfile(base.TestCase):
def setUp(self):
super(TestProfile, self).setUp()
@ -73,7 +73,7 @@ class TestProfile(testtools.TestCase):
self.assertEqual(FAKE['updated_at'], sot.updated_at)
class TestProfileValidate(testtools.TestCase):
class TestProfileValidate(base.TestCase):
def setUp(self):
super(TestProfileValidate, self).setUp()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import profile_type
@ -29,7 +29,7 @@ FAKE = {
}
class TestProfileType(testtools.TestCase):
class TestProfileType(base.TestCase):
def test_basic(self):
sot = profile_type.ProfileType()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import receiver
@ -40,7 +40,7 @@ FAKE = {
}
class TestReceiver(testtools.TestCase):
class TestReceiver(base.TestCase):
def setUp(self):
super(TestReceiver, self).setUp()

View File

@ -11,7 +11,7 @@
# under the License.
import mock
import testtools
from openstack.tests.unit import base
from openstack.clustering.v1 import service
@ -26,7 +26,7 @@ EXAMPLE = {
}
class TestService(testtools.TestCase):
class TestService(base.TestCase):
def setUp(self):
super(TestService, self).setUp()

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute import compute_service
class TestComputeService(testtools.TestCase):
class TestComputeService(base.TestCase):
def test_service(self):
sot = compute_service.ComputeService()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute import version
@ -23,7 +23,7 @@ EXAMPLE = {
}
class TestVersion(testtools.TestCase):
class TestVersion(base.TestCase):
def test_basic(self):
sot = version.Version()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import availability_zone as az
@ -23,7 +23,7 @@ BASIC_EXAMPLE = {
}
class TestAvailabilityZone(testtools.TestCase):
class TestAvailabilityZone(base.TestCase):
def test_basic(self):
sot = az.AvailabilityZone()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import extension
@ -25,7 +25,7 @@ EXAMPLE = {
}
class TestExtension(testtools.TestCase):
class TestExtension(base.TestCase):
def test_basic(self):
sot = extension.Extension()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import flavor
@ -30,7 +30,7 @@ BASIC_EXAMPLE = {
}
class TestFlavor(testtools.TestCase):
class TestFlavor(base.TestCase):
def test_basic(self):
sot = flavor.Flavor()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import hypervisor
@ -42,7 +42,7 @@ EXAMPLE = {
}
class TestHypervisor(testtools.TestCase):
class TestHypervisor(base.TestCase):
def test_basic(self):
sot = hypervisor.Hypervisor()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import image
@ -36,7 +36,7 @@ DETAIL_EXAMPLE = BASIC_EXAMPLE.copy()
DETAIL_EXAMPLE.update(DETAILS)
class TestImage(testtools.TestCase):
class TestImage(base.TestCase):
def test_basic(self):
sot = image.Image()

View File

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import keypair
@ -22,7 +22,7 @@ EXAMPLE = {
}
class TestKeypair(testtools.TestCase):
class TestKeypair(base.TestCase):
def test_basic(self):
sot = keypair.Keypair()

View File

@ -14,7 +14,7 @@ import copy
from keystoneauth1 import adapter
import mock
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import limits
@ -62,7 +62,7 @@ LIMITS_BODY = {
}
class TestAbsoluteLimits(testtools.TestCase):
class TestAbsoluteLimits(base.TestCase):
def test_basic(self):
sot = limits.AbsoluteLimits()
@ -112,7 +112,7 @@ class TestAbsoluteLimits(testtools.TestCase):
sot.total_cores_used)
class TestRateLimit(testtools.TestCase):
class TestRateLimit(base.TestCase):
def test_basic(self):
sot = limits.RateLimit()
@ -133,7 +133,7 @@ class TestRateLimit(testtools.TestCase):
self.assertEqual(RATE_LIMIT["limit"], sot.limits)
class TestLimits(testtools.TestCase):
class TestLimits(base.TestCase):
def test_basic(self):
sot = limits.Limits()

View File

@ -11,7 +11,7 @@
# under the License.
import mock
import testtools
from openstack.tests.unit import base
from openstack.compute.v2 import server
@ -24,7 +24,7 @@ IDENTIFIER = 'IDENTIFIER'
# working.
class TestMetadata(testtools.TestCase):
class TestMetadata(base.TestCase):
def setUp(self):
super(TestMetadata, self).setUp()

Some files were not shown because too many files have changed in this diff Show More