Remove v2 extension setting from functional tests
Now v2 API legacy code has been removed, functional tests do not need to set the v2 extensions. This patch removes the extension setting on osapi_compute_extension flag. Partially implements blueprint remove-legacy-v2-api-code Change-Id: If5db4b141702fa94777fc5706dec6c3fb6c9c594
This commit is contained in:
parent
2c8b08d310
commit
00b29d86e2
|
@ -210,13 +210,6 @@ class ExtensionManager(object):
|
|||
LOG.debug("Loading extension %s", ext_factory)
|
||||
|
||||
if isinstance(ext_factory, six.string_types):
|
||||
if ext_factory.startswith('nova.api.openstack.compute.contrib'):
|
||||
LOG.warning(_LW("The legacy v2 API module already moved into"
|
||||
"'nova.api.openstack.compute.legacy_v2.contrib'. "
|
||||
"Use new path instead of old path %s"),
|
||||
ext_factory)
|
||||
ext_factory = ext_factory.replace('contrib',
|
||||
'legacy_v2.contrib')
|
||||
# Load the factory
|
||||
factory = importutils.import_class(ext_factory)
|
||||
else:
|
||||
|
|
|
@ -84,7 +84,6 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
|
|||
osapi_compute_link_prefix=self._get_host(),
|
||||
osapi_glance_link_prefix=self._get_glance_host())
|
||||
if not self.all_extensions:
|
||||
self.flags(osapi_compute_extension=[])
|
||||
# Set the whitelist to ensure only the extensions we are
|
||||
# interested in are loaded so the api samples don't include
|
||||
# data from extensions we are not interested in
|
||||
|
|
|
@ -13,28 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = 'os-access-ips'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AccessIPsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def _servers_post(self, subs):
|
||||
response = self._do_post('servers', 'server-post-req', subs)
|
||||
return self._verify_response('server-post-resp', subs, response, 202)
|
||||
|
|
|
@ -13,22 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AdminActionsSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-admin-actions"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AdminActionsSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for AdminActions api samples extension
|
||||
|
||||
|
|
|
@ -13,24 +13,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.db.sqlalchemy import models
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AgentsJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-agents"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AgentsJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.agents.Agents')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(AgentsJsonTest, self).setUp()
|
||||
|
||||
|
|
|
@ -13,23 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-aggregates"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AggregatesSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.aggregates.Aggregates')
|
||||
return f
|
||||
|
||||
def test_aggregate_create(self):
|
||||
subs = {
|
||||
"aggregate_id": '(?P<id>\d+)'
|
||||
|
|
|
@ -12,24 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.api.openstack import fakes
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AssistedVolumeSnapshotsJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-assisted-volume-snapshots"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AssistedVolumeSnapshotsJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'assisted_volume_snapshots.Assisted_volume_snapshots')
|
||||
return f
|
||||
|
||||
def test_create(self):
|
||||
"""Create a volume snapshots."""
|
||||
self.stub_out('nova.compute.api.API.volume_snapshot_create',
|
||||
|
|
|
@ -13,26 +13,15 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.network import api as network_api
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit import fake_network_cache_model
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AttachInterfacesSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-attach-interfaces'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AttachInterfacesSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'attach_interfaces.Attach_interfaces')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(AttachInterfacesSampleJsonTest, self).setUp()
|
||||
|
||||
|
|
|
@ -12,24 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-availability-zone"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(AvailabilityZoneJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.availability_zone.'
|
||||
'Availability_zone')
|
||||
return f
|
||||
|
||||
def test_availability_zone_list(self):
|
||||
response = self._do_get('os-availability-zone')
|
||||
self._verify_response('availability-zone-list-resp', {}, response, 200)
|
||||
|
|
|
@ -14,11 +14,8 @@
|
|||
|
||||
import mock
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FakeNode(object):
|
||||
def __init__(self, uuid='058d27fa-241b-445a-a386-08c04f96db43'):
|
||||
|
@ -49,13 +46,6 @@ class BareMetalNodesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-baremetal-nodes"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(BareMetalNodesSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.baremetal_nodes.Baremetal_nodes')
|
||||
return f
|
||||
|
||||
@mock.patch("nova.api.openstack.compute.baremetal_nodes"
|
||||
"._get_ironic_client")
|
||||
def test_baremetal_nodes_list(self, mock_get_irc):
|
||||
|
|
|
@ -13,12 +13,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.api.openstack import fakes
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-block-device-mapping-v1"
|
||||
|
@ -32,8 +29,3 @@ class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase):
|
|||
|
||||
class BlockDeviceMappingV2BootJsonTest(BlockDeviceMappingV1BootJsonTest):
|
||||
extension_name = "os-block-device-mapping"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(BlockDeviceMappingV2BootJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
return f
|
||||
|
|
|
@ -28,15 +28,6 @@ CONF = nova.conf.CONF
|
|||
class CellsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-cells"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(CellsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.cells.Cells')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.cell_capacities.Cell_capacities')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
# db_check_interval < 0 makes cells manager always hit the DB
|
||||
self.flags(enable=True, db_check_interval=-1, group='cells')
|
||||
|
|
|
@ -13,23 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit import fake_crypto
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class CertificatesSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-certificates"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(CertificatesSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.certificates.Certificates')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(CertificatesSamplesJsonTest, self).setUp()
|
||||
self.stub_out('nova.crypto.ensure_ca_filesystem',
|
||||
|
|
|
@ -26,15 +26,6 @@ class CloudPipeSampleTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-cloudpipe"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(CloudPipeSampleTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.cloudpipe.Cloudpipe')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.cloudpipe_update.Cloudpipe_update')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(CloudPipeSampleTest, self).setUp()
|
||||
|
||||
|
|
|
@ -13,31 +13,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.api.openstack import fakes
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-config-drive'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ConfigDriveSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.config_drive.Config_drive')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(ConfigDriveSampleJsonTest, self).setUp()
|
||||
fakes.stub_out_networking(self)
|
||||
|
|
|
@ -16,27 +16,14 @@ import re
|
|||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ConsoleAuthTokensSampleJsonTests(test_servers.ServersSampleBase):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-console-auth-tokens"
|
||||
extra_extensions_to_load = ["os-remote-consoles", "os-access-ips"]
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ConsoleAuthTokensSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.consoles.Consoles')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.console_auth_tokens.'
|
||||
'Console_auth_tokens')
|
||||
return f
|
||||
|
||||
def _get_console_url(self, data):
|
||||
return jsonutils.loads(data)["console"]["url"]
|
||||
|
||||
|
|
|
@ -13,23 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ConsoleOutputSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-console-output"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ConsoleOutputSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.console_output.'
|
||||
'Console_output')
|
||||
return f
|
||||
|
||||
def test_get_console_output(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_post('servers/%s/action' % uuid,
|
||||
|
|
|
@ -15,23 +15,13 @@
|
|||
|
||||
import mock
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-create-backup"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(CreateBackupSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for PauseServer api samples extension
|
||||
|
||||
|
|
|
@ -13,23 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class DeferredDeleteSampleJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-deferred-delete"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(DeferredDeleteSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.deferred_delete.'
|
||||
'Deferred_delete')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(DeferredDeleteSampleJsonTests, self).setUp()
|
||||
self.flags(reclaim_instance_interval=1)
|
||||
|
|
|
@ -13,32 +13,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class DiskConfigJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-disk-config'
|
||||
extra_extensions_to_load = ["os-access-ips"]
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(DiskConfigJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.disk_config.'
|
||||
'Disk_config')
|
||||
return f
|
||||
|
||||
def test_list_servers_detail(self):
|
||||
uuid = self._post_server(use_common_server_api_samples=False)
|
||||
response = self._do_get('servers/detail')
|
||||
|
|
|
@ -15,27 +15,14 @@
|
|||
|
||||
import mock
|
||||
|
||||
import nova.conf
|
||||
from nova import objects
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class EvacuateJsonTest(test_servers.ServersSampleBase):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-evacuate"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(EvacuateJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.evacuate.Evacuate')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_evacuate_find_host.'
|
||||
'Extended_evacuate_find_host')
|
||||
return f
|
||||
|
||||
def _test_evacuate(self, req_subs, server_req, server_resp,
|
||||
expected_resp_code):
|
||||
self.uuid = self._post_server()
|
||||
|
|
|
@ -13,30 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-extended-availability-zone"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ExtendedAvailabilityZoneJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_availability_zone.'
|
||||
'Extended_availability_zone')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def test_show(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers/%s' % uuid)
|
||||
|
|
|
@ -13,30 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ExtendedServerAttributesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-extended-server-attributes"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ExtendedServerAttributesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_server_attributes.'
|
||||
'Extended_server_attributes')
|
||||
return f
|
||||
|
||||
def test_show(self):
|
||||
uuid = self._post_server()
|
||||
|
||||
|
|
|
@ -13,30 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ExtendedStatusSampleJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-extended-status"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ExtendedStatusSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_status.'
|
||||
'Extended_status')
|
||||
return f
|
||||
|
||||
def test_show(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers/%s' % uuid)
|
||||
|
|
|
@ -13,33 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.api.openstack import fakes
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-extended-volumes"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ExtendedVolumesSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_volumes.'
|
||||
'Extended_volumes')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.'
|
||||
'Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.'
|
||||
'Extended_ips')
|
||||
return f
|
||||
|
||||
def test_show(self):
|
||||
uuid = self._post_server()
|
||||
self.stub_out('nova.db.block_device_mapping_get_all_by_instance_uuids',
|
||||
|
|
|
@ -12,28 +12,18 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.objects import test_network
|
||||
from nova.tests.unit import utils as test_utils
|
||||
from nova.tests import uuidsentinel as uuids
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FixedIpTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-fixed-ips"
|
||||
|
||||
microversion = None
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FixedIpTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.fixed_ips.Fixed_ips')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(FixedIpTest, self).setUp()
|
||||
self.api.microversion = self.microversion
|
||||
|
|
|
@ -12,37 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FlavorAccessTestsBase(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = 'flavor-access'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FlavorAccessTestsBase, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'flavor_access.Flavor_access')
|
||||
# FlavorAccess extension also needs Flavormanage to be loaded.
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'flavormanage.Flavormanage')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'flavor_disabled.Flavor_disabled')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'flavorextradata.Flavorextradata')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'flavor_swap.Flavor_swap')
|
||||
return f
|
||||
|
||||
def _add_tenant(self):
|
||||
subs = {
|
||||
'tenant_id': 'fake_tenant',
|
||||
|
|
|
@ -13,24 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FlavorExtraSpecsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = 'flavor-extra-specs'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FlavorExtraSpecsSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavorextraspecs.'
|
||||
'Flavorextraspecs')
|
||||
return f
|
||||
|
||||
def _flavor_extra_specs_create(self):
|
||||
subs = {'value1': 'value1',
|
||||
'value2': 'value2'
|
||||
|
|
|
@ -13,36 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FlavorManageSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = 'flavor-manage'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FlavorManageSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavormanage.'
|
||||
'Flavormanage')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_disabled.'
|
||||
'Flavor_disabled')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_access.'
|
||||
'Flavor_access')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavorextradata.'
|
||||
'Flavorextradata')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_swap.'
|
||||
'Flavor_swap')
|
||||
return f
|
||||
|
||||
def _create_flavor(self):
|
||||
"""Create a flavor."""
|
||||
subs = {
|
||||
|
|
|
@ -13,39 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FlavorRxtxJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = 'os-flavor-rxtx'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FlavorRxtxJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_rxtx.'
|
||||
'Flavor_rxtx')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavormanage.'
|
||||
'Flavormanage')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_disabled.'
|
||||
'Flavor_disabled')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_access.'
|
||||
'Flavor_access')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavorextradata.'
|
||||
'Flavorextradata')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_swap.'
|
||||
'Flavor_swap')
|
||||
return f
|
||||
|
||||
def test_flavor_rxtx_get(self):
|
||||
flavor_id = '1'
|
||||
response = self._do_get('flavors/%s' % flavor_id)
|
||||
|
|
|
@ -13,28 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
sample_dir = 'flavors'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FlavorsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.flavor_swap.Flavor_swap')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.flavor_disabled.Flavor_disabled')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.flavor_access.Flavor_access')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.flavorextradata.Flavorextradata')
|
||||
return f
|
||||
|
||||
def test_flavors_get(self):
|
||||
response = self._do_get('flavors/1')
|
||||
self._verify_response('flavor-get-resp', {}, response, 200)
|
||||
|
@ -51,8 +35,3 @@ class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest):
|
||||
all_extensions = True
|
||||
sample_dir = None
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FlavorsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
return f
|
||||
|
|
|
@ -12,11 +12,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
|
@ -29,13 +26,6 @@ class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
dns_type = 'A'
|
||||
ip = '192.168.1.1'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FloatingIpDNSTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.floating_ip_dns.Floating_ip_dns')
|
||||
return f
|
||||
|
||||
def _create_or_update(self):
|
||||
subs = {'project': self.project,
|
||||
'scope': self.scope}
|
||||
|
|
|
@ -12,22 +12,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FloatingIPPoolsSampleTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-floating-ip-pools"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FloatingIPPoolsSampleTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.floating_ip_pools.Floating_ip_pools')
|
||||
return f
|
||||
|
||||
def test_list_floatingippools(self):
|
||||
pool_list = ["pool1", "pool2"]
|
||||
|
||||
|
|
|
@ -23,15 +23,6 @@ CONF = nova.conf.CONF
|
|||
class FloatingIpsTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-floating-ips"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FloatingIpsTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.floating_ips.Floating_ips')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.extended_floating_ips.Extended_floating_ips')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(FloatingIpsTest, self).setUp()
|
||||
pool = CONF.default_floating_pool
|
||||
|
|
|
@ -24,13 +24,6 @@ class FloatingIpsBulkTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-floating-ips-bulk"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FloatingIpsBulkTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.floating_ips_bulk.Floating_ips_bulk')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(FloatingIpsBulkTest, self).setUp()
|
||||
pool = CONF.default_floating_pool
|
||||
|
|
|
@ -13,23 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.api.openstack.compute import test_fping
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class FpingSampleJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-fping"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(FpingSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.fping.Fping')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(FpingSampleJsonTests, self).setUp()
|
||||
|
||||
|
|
|
@ -27,13 +27,6 @@ class ServersSampleHideAddressesJsonTest(test_servers.ServersSampleJsonTest):
|
|||
# to the extension name
|
||||
sample_dir = extension_name
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServersSampleHideAddressesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.hide_server_addresses.'
|
||||
'Hide_server_addresses')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
# We override osapi_hide_server_address_states in order
|
||||
# to have an example of in the json samples of the
|
||||
|
|
|
@ -13,23 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-hosts"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(HostsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.hosts.Hosts')
|
||||
return f
|
||||
|
||||
def test_host_startup(self):
|
||||
response = self._do_get('os-hosts/%s/startup' % self.compute.host)
|
||||
self._verify_response('host-get-startup', {}, response, 200)
|
||||
|
|
|
@ -16,30 +16,14 @@
|
|||
import mock
|
||||
|
||||
from nova.cells import utils as cells_utils
|
||||
import nova.conf
|
||||
from nova import objects
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-hypervisors"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(HypervisorsSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.hypervisors.Hypervisors')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_hypervisors.'
|
||||
'Extended_hypervisors')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.hypervisor_status.'
|
||||
'Hypervisor_status')
|
||||
return f
|
||||
|
||||
def test_hypervisors_list(self):
|
||||
response = self._do_get('os-hypervisors')
|
||||
self._verify_response('hypervisors-list-resp', {}, response, 200)
|
||||
|
@ -112,16 +96,6 @@ class HypervisorsCellsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-hypervisors"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(HypervisorsCellsSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.hypervisors.Hypervisors')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.hypervisor_status.'
|
||||
'Hypervisor_status')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
self.flags(enable=True, cell_type='api', group='cells')
|
||||
super(HypervisorsCellsSampleJsonTests, self).setUp()
|
||||
|
|
|
@ -17,27 +17,17 @@ import copy
|
|||
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit import fake_instance
|
||||
from nova.tests.unit import fake_server_actions
|
||||
from nova.tests.unit import utils as test_utils
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServerActionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
microversion = None
|
||||
ADMIN_API = True
|
||||
extension_name = 'os-instance-actions'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerActionsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.instance_actions.Instance_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(ServerActionsSampleJsonTest, self).setUp()
|
||||
self.api.microversion = self.microversion
|
||||
|
|
|
@ -15,24 +15,13 @@
|
|||
|
||||
from six.moves import urllib
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class InstanceUsageAuditLogJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-instance-usage-audit-log"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(InstanceUsageAuditLogJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.instance_usage_audit_log.'
|
||||
'Instance_usage_audit_log')
|
||||
return f
|
||||
|
||||
def test_show_instance_usage_audit_log(self):
|
||||
response = self._do_get('os-instance_usage_audit_log/%s' %
|
||||
urllib.parse.quote('2012-07-05 10:00:00'))
|
||||
|
|
|
@ -15,13 +15,10 @@
|
|||
|
||||
import uuid
|
||||
|
||||
import nova.conf
|
||||
from nova.objects import keypair as keypair_obj
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit import fake_crypto
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
microversion = None
|
||||
|
@ -29,13 +26,6 @@ class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
expected_delete_status_code = 202
|
||||
expected_post_status_code = 200
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(KeyPairsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(KeyPairsSampleJsonTest, self).setUp()
|
||||
self.api.microversion = self.microversion
|
||||
|
|
|
@ -13,11 +13,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
|
@ -29,11 +26,6 @@ class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
# and V2.1 as the response are different.
|
||||
self.template = 'limit-get-resp'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(LimitsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
return f
|
||||
|
||||
def test_limits_get(self):
|
||||
response = self._do_get('limits')
|
||||
self._verify_response(self.template, {}, response, 200)
|
||||
|
|
|
@ -13,22 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class LockServerSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-lock-server"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(LockServerSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for LockServer api samples extension
|
||||
|
||||
|
|
|
@ -16,24 +16,13 @@
|
|||
import mock
|
||||
from oslo_utils import versionutils
|
||||
|
||||
import nova.conf
|
||||
from nova import objects
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-migrate-server"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(MigrateServerSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.'
|
||||
'Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for MigrateServer api samples extension
|
||||
|
||||
|
|
|
@ -15,13 +15,10 @@
|
|||
|
||||
import datetime
|
||||
|
||||
import nova.conf
|
||||
from nova import context
|
||||
from nova import objects
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
# NOTE(ShaoHe Feng) here I can not use uuidsentinel, it generate a random
|
||||
# UUID. The uuid in doc/api_samples files is fixed.
|
||||
|
@ -75,13 +72,6 @@ class MigrationsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-migrations"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(MigrationsSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.migrations.Migrations')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(MigrationsSamplesJsonTest, self).setUp()
|
||||
self.stub_out('nova.compute.api.API.get_migrations',
|
||||
|
|
|
@ -13,23 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class MultinicSampleJsonTest(test_servers.ServersSampleBase):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-multinic"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(MultinicSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.multinic.Multinic')
|
||||
return f
|
||||
|
||||
def _disable_instance_dns_manager(self):
|
||||
# NOTE(markmc): it looks like multinic and instance_dns_manager are
|
||||
# incompatible. See:
|
||||
|
|
|
@ -13,24 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class MultipleCreateJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-multiple-create"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(MultipleCreateJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.multiple_create.'
|
||||
'Multiple_create')
|
||||
return f
|
||||
|
||||
def test_multiple_create(self):
|
||||
subs = {
|
||||
'image_id': fake.get_valid_image_id(),
|
||||
|
|
|
@ -13,12 +13,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit.api.openstack.compute import test_networks
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
def _fixtures_passthrough(method_name):
|
||||
# This compensates for how fixtures 3.x handles the signatures of
|
||||
|
@ -43,15 +40,6 @@ class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-networks"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(NetworksJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.os_networks.Os_networks')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.extended_networks.Extended_networks')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(NetworksJsonTests, self).setUp()
|
||||
self.stub_out("nova.network.api.API.get_all",
|
||||
|
|
|
@ -13,11 +13,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
|
@ -26,17 +23,6 @@ class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||
|
||||
_sentinel = object()
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(NetworksAssociateJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
# Networks_associate requires Networks to be update
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.os_networks.Os_networks')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.networks_associate.'
|
||||
'Networks_associate')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(NetworksAssociateJsonTests, self).setUp()
|
||||
|
||||
|
|
|
@ -13,22 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class PauseServerSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-pause-server"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(PauseServerSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for PauseServer api samples extension
|
||||
|
||||
|
|
|
@ -13,24 +13,13 @@
|
|||
# under the License.
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-preserve-ephemeral-rebuild'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(PreserveEphemeralOnRebuildJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.preserve_ephemeral_rebuild.'
|
||||
'Preserve_ephemeral_rebuild')
|
||||
return f
|
||||
|
||||
def _test_server_rebuild_preserve_ephemeral(self, value, resp_tpl=None):
|
||||
uuid = self._post_server()
|
||||
image = fake.get_valid_image_id()
|
||||
|
|
|
@ -13,25 +13,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class QuotaClassesSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-quota-class-sets"
|
||||
set_id = 'test_class'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(QuotaClassesSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.quota_classes.'
|
||||
'Quota_classes')
|
||||
return f
|
||||
|
||||
def test_show_quota_classes(self):
|
||||
# Get api sample to show quota classes.
|
||||
response = self._do_get('os-quota-class-sets/%s' % self.set_id)
|
||||
|
|
|
@ -13,30 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-quota-sets"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(QuotaSetsSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.server_group_quotas.'
|
||||
'Server_group_quotas')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.quotas.Quotas')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.extended_quotas.Extended_quotas')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.user_quotas.User_quotas')
|
||||
return f
|
||||
|
||||
def test_show_quotas(self):
|
||||
# Get api sample to show quotas.
|
||||
response = self._do_get('os-quota-sets/fake_tenant')
|
||||
|
|
|
@ -13,23 +13,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ConsolesSampleJsonTests(test_servers.ServersSampleBase):
|
||||
microversion = None
|
||||
extension_name = "os-remote-consoles"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ConsolesSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.consoles.Consoles')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(ConsolesSampleJsonTests, self).setUp()
|
||||
self.api.microversion = self.microversion
|
||||
|
|
|
@ -13,32 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class RescueJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-rescue"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(RescueJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.rescue.Rescue')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_rescue_with_image.'
|
||||
'Extended_rescue_with_image')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def _rescue(self, uuid):
|
||||
req_subs = {
|
||||
'password': 'MySecretPass'
|
||||
|
|
|
@ -15,24 +15,13 @@
|
|||
|
||||
import uuid
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class SchedulerHintsJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-scheduler-hints"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(SchedulerHintsJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
"nova.api.openstack.compute.contrib.scheduler_hints."
|
||||
"Scheduler_hints")
|
||||
return f
|
||||
|
||||
def test_scheduler_hints_post(self):
|
||||
# Get api sample of scheduler hint post request.
|
||||
subs = {'image_id': fake.get_valid_image_id(),
|
||||
|
|
|
@ -12,25 +12,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class SecurityGroupDefaultRulesSampleJsonTest(
|
||||
api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = 'os-security-group-default-rules'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(SecurityGroupDefaultRulesSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.security_group_default_rules.'
|
||||
'Security_group_default_rules')
|
||||
return f
|
||||
|
||||
def test_security_group_default_rules_create(self):
|
||||
response = self._do_post('os-security-group-default-rules',
|
||||
'security-group-default-rules-create-req',
|
||||
|
|
|
@ -13,12 +13,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
import nova.tests.functional.api_samples_test_base as astb
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
def fake_get(*args, **kwargs):
|
||||
nova_group = {}
|
||||
|
@ -63,21 +60,6 @@ def fake_create_security_group(self, context, name, description):
|
|||
class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-security-groups'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(SecurityGroupsJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.security_groups.'
|
||||
'Security_groups')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
self.flags(security_group_api=('neutron'))
|
||||
super(SecurityGroupsJsonTest, self).setUp()
|
||||
|
|
|
@ -13,23 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-server-diagnostics"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerDiagnosticsSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_diagnostics.'
|
||||
'Server_diagnostics')
|
||||
return f
|
||||
|
||||
def test_server_diagnostics_get(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers/%s/diagnostics' % uuid)
|
||||
|
|
|
@ -12,24 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServerExternalEventsSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-server-external-events"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerExternalEventsSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_external_events.'
|
||||
'Server_external_events')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for AdminActions api samples extension
|
||||
|
||||
|
|
|
@ -13,22 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServerGroupsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-server-groups"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerGroupsSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_groups.Server_groups')
|
||||
return f
|
||||
|
||||
def _get_create_subs(self):
|
||||
return {'name': 'test'}
|
||||
|
||||
|
|
|
@ -14,23 +14,12 @@
|
|||
|
||||
import mock
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServerPasswordSampleJsonTests(test_servers.ServersSampleBase):
|
||||
extension_name = "os-server-password"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerPasswordSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_password.'
|
||||
'Server_password')
|
||||
return f
|
||||
|
||||
@mock.patch("nova.api.metadata.password.extract_password")
|
||||
def test_get_password(self, mock_extract_password):
|
||||
password = ("xlozO3wLCBRWAa2yDjCCVx8vwNPypxnypmRYDa/zErlQ+EzPe1S/"
|
||||
|
|
|
@ -13,29 +13,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServerUsageSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = 'os-server-usage'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerUsageSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_usage.Server_usage')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp method for server usage."""
|
||||
super(ServerUsageSampleJsonTest, self).setUp()
|
||||
|
|
|
@ -13,12 +13,9 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
|
||||
extra_extensions_to_load = ["os-access-ips"]
|
||||
|
@ -71,18 +68,6 @@ class ServersSampleJsonTest(ServersSampleBase):
|
|||
sample_dir = 'servers'
|
||||
microversion = None
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServersSampleBase, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.keypairs.Keypairs')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips.Extended_ips')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.extended_ips_mac.'
|
||||
'Extended_ips_mac')
|
||||
return f
|
||||
|
||||
def test_servers_post(self):
|
||||
return self._post_server()
|
||||
|
||||
|
@ -167,14 +152,6 @@ class ServersUpdateSampleJsonTest(ServersSampleBase):
|
|||
class ServerSortKeysJsonTests(ServersSampleBase):
|
||||
sample_dir = 'servers-sort'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerSortKeysJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_sort_keys.'
|
||||
'Server_sort_keys')
|
||||
return f
|
||||
|
||||
def test_servers_list(self):
|
||||
self._post_server()
|
||||
response = self._do_get('servers?sort_key=display_name&sort_dir=asc')
|
||||
|
@ -294,14 +271,6 @@ class ServersActionsAllJsonTest(ServersActionsJsonTest):
|
|||
class ServerStartStopJsonTest(ServersSampleBase):
|
||||
sample_dir = 'servers'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServerStartStopJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.server_start_stop.'
|
||||
'Server_start_stop')
|
||||
return f
|
||||
|
||||
def _test_server_action(self, uuid, action, req_tpl):
|
||||
response = self._do_post('servers/%s/action' % uuid,
|
||||
req_tpl,
|
||||
|
@ -323,11 +292,6 @@ class ServersSampleMultiStatusJsonTest(ServersSampleBase):
|
|||
sample_dir = 'servers'
|
||||
extra_extensions_to_load = ["os-access-ips"]
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServersSampleMultiStatusJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
return f
|
||||
|
||||
def test_servers_list(self):
|
||||
uuid = self._post_server()
|
||||
response = self._do_get('servers?status=active&status=error')
|
||||
|
|
|
@ -15,31 +15,15 @@
|
|||
|
||||
from oslo_utils import fixture as utils_fixture
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit.api.openstack.compute import test_services
|
||||
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class ServicesJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
ADMIN_API = True
|
||||
extension_name = "os-services"
|
||||
microversion = None
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ServicesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.services.Services')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.extended_services_delete.'
|
||||
'Extended_services_delete')
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.extended_services.Extended_services')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(ServicesJsonTest, self).setUp()
|
||||
self.api.microversion = self.microversion
|
||||
|
|
|
@ -23,13 +23,6 @@ CONF = nova.conf.CONF
|
|||
class ShelveJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-shelve"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(ShelveJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.shelve.Shelve')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(ShelveJsonTest, self).setUp()
|
||||
# Don't offload instance, so we can test the offload call.
|
||||
|
|
|
@ -17,24 +17,13 @@ import urllib
|
|||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
import nova.tests.functional.api_samples_test_base as astb
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class SimpleTenantUsageSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-simple-tenant-usage"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(SimpleTenantUsageSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.simple_tenant_usage.'
|
||||
'Simple_tenant_usage')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp method for simple tenant usage."""
|
||||
super(SimpleTenantUsageSampleJsonTest, self).setUp()
|
||||
|
|
|
@ -12,22 +12,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-suspend-server"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(SuspendServerSamplesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.admin_actions.Admin_actions')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
"""setUp Method for SuspendServer api samples extension
|
||||
|
||||
|
|
|
@ -26,13 +26,6 @@ class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||
ADMIN_API = True
|
||||
extension_name = "os-tenant-networks"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(TenantNetworksJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append('nova.api.openstack.compute.'
|
||||
'contrib.os_tenant_networks.Os_tenant_networks')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(TenantNetworksJsonTests, self).setUp()
|
||||
CONF.set_override("enable_network_quota", True)
|
||||
|
|
|
@ -15,23 +15,13 @@
|
|||
|
||||
import base64
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
from nova.tests.unit.image import fake
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-user-data"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(UserDataJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.user_data.User_data')
|
||||
return f
|
||||
|
||||
def test_user_data_post(self):
|
||||
user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'
|
||||
user_data = base64.b64encode(user_data_contents)
|
||||
|
|
|
@ -13,11 +13,8 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import nova.conf
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class VirtualInterfacesJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-virtual-interfaces"
|
||||
|
@ -28,11 +25,6 @@ class VirtualInterfacesJsonTest(test_servers.ServersSampleBase):
|
|||
if self.api_major_version == 'v2':
|
||||
self.template = 'vifs-list-resp-v2'
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(VirtualInterfacesJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
return f
|
||||
|
||||
def test_vifs_list(self):
|
||||
uuid = self._post_server()
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
import datetime
|
||||
|
||||
import nova.conf
|
||||
from nova import context
|
||||
from nova import objects
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
@ -24,8 +23,6 @@ from nova.tests.unit.api.openstack import fakes
|
|||
from nova.tests.unit import fake_block_device
|
||||
from nova.tests.unit import fake_instance
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
||||
extension_name = "os-volumes"
|
||||
|
@ -36,13 +33,6 @@ class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
|
|||
'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c'
|
||||
}
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(SnapshotsSampleJsonTests, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.volumes.Volumes')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(SnapshotsSampleJsonTests, self).setUp()
|
||||
self.stub_out("nova.volume.cinder.API.get_all_snapshots",
|
||||
|
@ -142,13 +132,6 @@ def _stub_volume_create(stub_self, context, size, name, description,
|
|||
class VolumesSampleJsonTest(test_servers.ServersSampleBase):
|
||||
extension_name = "os-volumes"
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(VolumesSampleJsonTest, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.volumes.Volumes')
|
||||
return f
|
||||
|
||||
def setUp(self):
|
||||
super(VolumesSampleJsonTest, self).setUp()
|
||||
fakes.stub_out_networking(self)
|
||||
|
@ -243,16 +226,6 @@ class VolumeAttachmentsSample(test_servers.ServersSampleBase):
|
|||
|
||||
self.stub_out('nova.compute.api.API.get', fake_compute_api_get)
|
||||
|
||||
def _get_flags(self):
|
||||
f = super(VolumeAttachmentsSample, self)._get_flags()
|
||||
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.volumes.Volumes')
|
||||
f['osapi_compute_extension'].append(
|
||||
'nova.api.openstack.compute.contrib.'
|
||||
'volume_attachment_update.Volume_attachment_update')
|
||||
return f
|
||||
|
||||
def test_attach_volume_to_server(self):
|
||||
self.stub_out('nova.volume.cinder.API.get', fakes.stub_volume_get)
|
||||
self.stub_out('nova.volume.cinder.API.check_attach',
|
||||
|
|
Loading…
Reference in New Issue