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:
ghanshyam 2016-06-08 12:46:15 +09:00
parent 2c8b08d310
commit 00b29d86e2
73 changed files with 0 additions and 931 deletions

View File

@ -210,13 +210,6 @@ class ExtensionManager(object):
LOG.debug("Loading extension %s", ext_factory) LOG.debug("Loading extension %s", ext_factory)
if isinstance(ext_factory, six.string_types): 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 # Load the factory
factory = importutils.import_class(ext_factory) factory = importutils.import_class(ext_factory)
else: else:

View File

@ -84,7 +84,6 @@ class ApiSampleTestBaseV21(testscenarios.WithScenarios,
osapi_compute_link_prefix=self._get_host(), osapi_compute_link_prefix=self._get_host(),
osapi_glance_link_prefix=self._get_glance_host()) osapi_glance_link_prefix=self._get_glance_host())
if not self.all_extensions: if not self.all_extensions:
self.flags(osapi_compute_extension=[])
# Set the whitelist to ensure only the extensions we are # Set the whitelist to ensure only the extensions we are
# interested in are loaded so the api samples don't include # interested in are loaded so the api samples don't include
# data from extensions we are not interested in # data from extensions we are not interested in

View File

@ -13,28 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class AccessIPsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = 'os-access-ips' 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): def _servers_post(self, subs):
response = self._do_post('servers', 'server-post-req', subs) response = self._do_post('servers', 'server-post-req', subs)
return self._verify_response('server-post-resp', subs, response, 202) return self._verify_response('server-post-resp', subs, response, 202)

View File

@ -13,22 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class AdminActionsSamplesJsonTest(test_servers.ServersSampleBase): class AdminActionsSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-admin-actions" 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): def setUp(self):
"""setUp Method for AdminActions api samples extension """setUp Method for AdminActions api samples extension

View File

@ -13,24 +13,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.db.sqlalchemy import models from nova.db.sqlalchemy import models
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class AgentsJsonTest(api_sample_base.ApiSampleTestBaseV21): class AgentsJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-agents" 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): def setUp(self):
super(AgentsJsonTest, self).setUp() super(AgentsJsonTest, self).setUp()

View File

@ -13,23 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class AggregatesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-aggregates" 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): def test_aggregate_create(self):
subs = { subs = {
"aggregate_id": '(?P<id>\d+)' "aggregate_id": '(?P<id>\d+)'

View File

@ -12,24 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack import fakes from nova.tests.unit.api.openstack import fakes
CONF = nova.conf.CONF
class AssistedVolumeSnapshotsJsonTests(test_servers.ServersSampleBase): class AssistedVolumeSnapshotsJsonTests(test_servers.ServersSampleBase):
extension_name = "os-assisted-volume-snapshots" 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): def test_create(self):
"""Create a volume snapshots.""" """Create a volume snapshots."""
self.stub_out('nova.compute.api.API.volume_snapshot_create', self.stub_out('nova.compute.api.API.volume_snapshot_create',

View File

@ -13,26 +13,15 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova import exception from nova import exception
from nova.network import api as network_api from nova.network import api as network_api
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit import fake_network_cache_model from nova.tests.unit import fake_network_cache_model
CONF = nova.conf.CONF
class AttachInterfacesSampleJsonTest(test_servers.ServersSampleBase): class AttachInterfacesSampleJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-attach-interfaces' 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): def setUp(self):
super(AttachInterfacesSampleJsonTest, self).setUp() super(AttachInterfacesSampleJsonTest, self).setUp()

View File

@ -12,24 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class AvailabilityZoneJsonTest(test_servers.ServersSampleBase): class AvailabilityZoneJsonTest(test_servers.ServersSampleBase):
ADMIN_API = True ADMIN_API = True
extension_name = "os-availability-zone" 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): def test_availability_zone_list(self):
response = self._do_get('os-availability-zone') response = self._do_get('os-availability-zone')
self._verify_response('availability-zone-list-resp', {}, response, 200) self._verify_response('availability-zone-list-resp', {}, response, 200)

View File

@ -14,11 +14,8 @@
import mock import mock
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FakeNode(object): class FakeNode(object):
def __init__(self, uuid='058d27fa-241b-445a-a386-08c04f96db43'): def __init__(self, uuid='058d27fa-241b-445a-a386-08c04f96db43'):
@ -49,13 +46,6 @@ class BareMetalNodesSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-baremetal-nodes" 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" @mock.patch("nova.api.openstack.compute.baremetal_nodes"
"._get_ironic_client") "._get_ironic_client")
def test_baremetal_nodes_list(self, mock_get_irc): def test_baremetal_nodes_list(self, mock_get_irc):

View File

@ -13,12 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack import fakes from nova.tests.unit.api.openstack import fakes
CONF = nova.conf.CONF
class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase): class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase):
extension_name = "os-block-device-mapping-v1" extension_name = "os-block-device-mapping-v1"
@ -32,8 +29,3 @@ class BlockDeviceMappingV1BootJsonTest(test_servers.ServersSampleBase):
class BlockDeviceMappingV2BootJsonTest(BlockDeviceMappingV1BootJsonTest): class BlockDeviceMappingV2BootJsonTest(BlockDeviceMappingV1BootJsonTest):
extension_name = "os-block-device-mapping" 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

View File

@ -28,15 +28,6 @@ CONF = nova.conf.CONF
class CellsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class CellsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-cells" 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): def setUp(self):
# db_check_interval < 0 makes cells manager always hit the DB # db_check_interval < 0 makes cells manager always hit the DB
self.flags(enable=True, db_check_interval=-1, group='cells') self.flags(enable=True, db_check_interval=-1, group='cells')

View File

@ -13,23 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit import fake_crypto from nova.tests.unit import fake_crypto
CONF = nova.conf.CONF
class CertificatesSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21): class CertificatesSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-certificates" 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): def setUp(self):
super(CertificatesSamplesJsonTest, self).setUp() super(CertificatesSamplesJsonTest, self).setUp()
self.stub_out('nova.crypto.ensure_ca_filesystem', self.stub_out('nova.crypto.ensure_ca_filesystem',

View File

@ -26,15 +26,6 @@ class CloudPipeSampleTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-cloudpipe" 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): def setUp(self):
super(CloudPipeSampleTest, self).setUp() super(CloudPipeSampleTest, self).setUp()

View File

@ -13,31 +13,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack import fakes from nova.tests.unit.api.openstack import fakes
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase): class ConfigDriveSampleJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-config-drive' 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): def setUp(self):
super(ConfigDriveSampleJsonTest, self).setUp() super(ConfigDriveSampleJsonTest, self).setUp()
fakes.stub_out_networking(self) fakes.stub_out_networking(self)

View File

@ -16,27 +16,14 @@ import re
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ConsoleAuthTokensSampleJsonTests(test_servers.ServersSampleBase): class ConsoleAuthTokensSampleJsonTests(test_servers.ServersSampleBase):
ADMIN_API = True ADMIN_API = True
extension_name = "os-console-auth-tokens" extension_name = "os-console-auth-tokens"
extra_extensions_to_load = ["os-remote-consoles", "os-access-ips"] 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): def _get_console_url(self, data):
return jsonutils.loads(data)["console"]["url"] return jsonutils.loads(data)["console"]["url"]

View File

@ -13,23 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ConsoleOutputSampleJsonTest(test_servers.ServersSampleBase): class ConsoleOutputSampleJsonTest(test_servers.ServersSampleBase):
extension_name = "os-console-output" 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): def test_get_console_output(self):
uuid = self._post_server() uuid = self._post_server()
response = self._do_post('servers/%s/action' % uuid, response = self._do_post('servers/%s/action' % uuid,

View File

@ -15,23 +15,13 @@
import mock import mock
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase): class CreateBackupSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-create-backup" 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): def setUp(self):
"""setUp Method for PauseServer api samples extension """setUp Method for PauseServer api samples extension

View File

@ -13,23 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class DeferredDeleteSampleJsonTests(test_servers.ServersSampleBase): class DeferredDeleteSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-deferred-delete" 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): def setUp(self):
super(DeferredDeleteSampleJsonTests, self).setUp() super(DeferredDeleteSampleJsonTests, self).setUp()
self.flags(reclaim_instance_interval=1) self.flags(reclaim_instance_interval=1)

View File

@ -13,32 +13,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class DiskConfigJsonTest(test_servers.ServersSampleBase): class DiskConfigJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-disk-config' extension_name = 'os-disk-config'
extra_extensions_to_load = ["os-access-ips"] 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): def test_list_servers_detail(self):
uuid = self._post_server(use_common_server_api_samples=False) uuid = self._post_server(use_common_server_api_samples=False)
response = self._do_get('servers/detail') response = self._do_get('servers/detail')

View File

@ -15,27 +15,14 @@
import mock import mock
import nova.conf
from nova import objects from nova import objects
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class EvacuateJsonTest(test_servers.ServersSampleBase): class EvacuateJsonTest(test_servers.ServersSampleBase):
ADMIN_API = True ADMIN_API = True
extension_name = "os-evacuate" 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, def _test_evacuate(self, req_subs, server_req, server_resp,
expected_resp_code): expected_resp_code):
self.uuid = self._post_server() self.uuid = self._post_server()

View File

@ -13,30 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase): class ExtendedAvailabilityZoneJsonTests(test_servers.ServersSampleBase):
extension_name = "os-extended-availability-zone" 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): def test_show(self):
uuid = self._post_server() uuid = self._post_server()
response = self._do_get('servers/%s' % uuid) response = self._do_get('servers/%s' % uuid)

View File

@ -13,30 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ExtendedServerAttributesJsonTest(test_servers.ServersSampleBase): class ExtendedServerAttributesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-extended-server-attributes" 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): def test_show(self):
uuid = self._post_server() uuid = self._post_server()

View File

@ -13,30 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ExtendedStatusSampleJsonTests(test_servers.ServersSampleBase): class ExtendedStatusSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-extended-status" 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): def test_show(self):
uuid = self._post_server() uuid = self._post_server()
response = self._do_get('servers/%s' % uuid) response = self._do_get('servers/%s' % uuid)

View File

@ -13,33 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack import fakes from nova.tests.unit.api.openstack import fakes
CONF = nova.conf.CONF
class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase): class ExtendedVolumesSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-extended-volumes" 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): def test_show(self):
uuid = self._post_server() uuid = self._post_server()
self.stub_out('nova.db.block_device_mapping_get_all_by_instance_uuids', self.stub_out('nova.db.block_device_mapping_get_all_by_instance_uuids',

View File

@ -12,28 +12,18 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova import exception from nova import exception
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.objects import test_network from nova.tests.unit.objects import test_network
from nova.tests.unit import utils as test_utils from nova.tests.unit import utils as test_utils
from nova.tests import uuidsentinel as uuids from nova.tests import uuidsentinel as uuids
CONF = nova.conf.CONF
class FixedIpTest(test_servers.ServersSampleBase): class FixedIpTest(test_servers.ServersSampleBase):
extension_name = "os-fixed-ips" extension_name = "os-fixed-ips"
microversion = None 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): def setUp(self):
super(FixedIpTest, self).setUp() super(FixedIpTest, self).setUp()
self.api.microversion = self.microversion self.api.microversion = self.microversion

View File

@ -12,37 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FlavorAccessTestsBase(api_sample_base.ApiSampleTestBaseV21): class FlavorAccessTestsBase(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = 'flavor-access' 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): def _add_tenant(self):
subs = { subs = {
'tenant_id': 'fake_tenant', 'tenant_id': 'fake_tenant',

View File

@ -13,24 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FlavorExtraSpecsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): class FlavorExtraSpecsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = 'flavor-extra-specs' 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): def _flavor_extra_specs_create(self):
subs = {'value1': 'value1', subs = {'value1': 'value1',
'value2': 'value2' 'value2': 'value2'

View File

@ -13,36 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FlavorManageSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): class FlavorManageSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = 'flavor-manage' 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): def _create_flavor(self):
"""Create a flavor.""" """Create a flavor."""
subs = { subs = {

View File

@ -13,39 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FlavorRxtxJsonTest(api_sample_base.ApiSampleTestBaseV21): class FlavorRxtxJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = 'os-flavor-rxtx' 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): def test_flavor_rxtx_get(self):
flavor_id = '1' flavor_id = '1'
response = self._do_get('flavors/%s' % flavor_id) response = self._do_get('flavors/%s' % flavor_id)

View File

@ -13,28 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
sample_dir = 'flavors' 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): def test_flavors_get(self):
response = self._do_get('flavors/1') response = self._do_get('flavors/1')
self._verify_response('flavor-get-resp', {}, response, 200) self._verify_response('flavor-get-resp', {}, response, 200)
@ -51,8 +35,3 @@ class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest): class FlavorsSampleAllExtensionJsonTest(FlavorsSampleJsonTest):
all_extensions = True all_extensions = True
sample_dir = None sample_dir = None
def _get_flags(self):
f = super(FlavorsSampleJsonTest, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
return f

View File

@ -12,11 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21): class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
@ -29,13 +26,6 @@ class FloatingIpDNSTest(api_sample_base.ApiSampleTestBaseV21):
dns_type = 'A' dns_type = 'A'
ip = '192.168.1.1' 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): def _create_or_update(self):
subs = {'project': self.project, subs = {'project': self.project,
'scope': self.scope} 'scope': self.scope}

View File

@ -12,22 +12,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FloatingIPPoolsSampleTests(api_sample_base.ApiSampleTestBaseV21): class FloatingIPPoolsSampleTests(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-floating-ip-pools" 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): def test_list_floatingippools(self):
pool_list = ["pool1", "pool2"] pool_list = ["pool1", "pool2"]

View File

@ -23,15 +23,6 @@ CONF = nova.conf.CONF
class FloatingIpsTest(api_sample_base.ApiSampleTestBaseV21): class FloatingIpsTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-floating-ips" 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): def setUp(self):
super(FloatingIpsTest, self).setUp() super(FloatingIpsTest, self).setUp()
pool = CONF.default_floating_pool pool = CONF.default_floating_pool

View File

@ -24,13 +24,6 @@ class FloatingIpsBulkTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-floating-ips-bulk" 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): def setUp(self):
super(FloatingIpsBulkTest, self).setUp() super(FloatingIpsBulkTest, self).setUp()
pool = CONF.default_floating_pool pool = CONF.default_floating_pool

View File

@ -13,23 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.api.openstack.compute import test_fping from nova.tests.unit.api.openstack.compute import test_fping
CONF = nova.conf.CONF
class FpingSampleJsonTests(test_servers.ServersSampleBase): class FpingSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-fping" 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): def setUp(self):
super(FpingSampleJsonTests, self).setUp() super(FpingSampleJsonTests, self).setUp()

View File

@ -27,13 +27,6 @@ class ServersSampleHideAddressesJsonTest(test_servers.ServersSampleJsonTest):
# to the extension name # to the extension name
sample_dir = 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): def setUp(self):
# We override osapi_hide_server_address_states in order # We override osapi_hide_server_address_states in order
# to have an example of in the json samples of the # to have an example of in the json samples of the

View File

@ -13,23 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-hosts" 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): def test_host_startup(self):
response = self._do_get('os-hosts/%s/startup' % self.compute.host) response = self._do_get('os-hosts/%s/startup' % self.compute.host)
self._verify_response('host-get-startup', {}, response, 200) self._verify_response('host-get-startup', {}, response, 200)

View File

@ -16,30 +16,14 @@
import mock import mock
from nova.cells import utils as cells_utils from nova.cells import utils as cells_utils
import nova.conf
from nova import objects from nova import objects
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): class HypervisorsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-hypervisors" 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): def test_hypervisors_list(self):
response = self._do_get('os-hypervisors') response = self._do_get('os-hypervisors')
self._verify_response('hypervisors-list-resp', {}, response, 200) self._verify_response('hypervisors-list-resp', {}, response, 200)
@ -112,16 +96,6 @@ class HypervisorsCellsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-hypervisors" 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): def setUp(self):
self.flags(enable=True, cell_type='api', group='cells') self.flags(enable=True, cell_type='api', group='cells')
super(HypervisorsCellsSampleJsonTests, self).setUp() super(HypervisorsCellsSampleJsonTests, self).setUp()

View File

@ -17,27 +17,17 @@ import copy
import six import six
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit import fake_instance from nova.tests.unit import fake_instance
from nova.tests.unit import fake_server_actions from nova.tests.unit import fake_server_actions
from nova.tests.unit import utils as test_utils from nova.tests.unit import utils as test_utils
CONF = nova.conf.CONF
class ServerActionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class ServerActionsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
microversion = None microversion = None
ADMIN_API = True ADMIN_API = True
extension_name = 'os-instance-actions' 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): def setUp(self):
super(ServerActionsSampleJsonTest, self).setUp() super(ServerActionsSampleJsonTest, self).setUp()
self.api.microversion = self.microversion self.api.microversion = self.microversion

View File

@ -15,24 +15,13 @@
from six.moves import urllib from six.moves import urllib
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class InstanceUsageAuditLogJsonTest(api_sample_base.ApiSampleTestBaseV21): class InstanceUsageAuditLogJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-instance-usage-audit-log" 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): def test_show_instance_usage_audit_log(self):
response = self._do_get('os-instance_usage_audit_log/%s' % response = self._do_get('os-instance_usage_audit_log/%s' %
urllib.parse.quote('2012-07-05 10:00:00')) urllib.parse.quote('2012-07-05 10:00:00'))

View File

@ -15,13 +15,10 @@
import uuid import uuid
import nova.conf
from nova.objects import keypair as keypair_obj from nova.objects import keypair as keypair_obj
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit import fake_crypto from nova.tests.unit import fake_crypto
CONF = nova.conf.CONF
class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
microversion = None microversion = None
@ -29,13 +26,6 @@ class KeyPairsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
expected_delete_status_code = 202 expected_delete_status_code = 202
expected_post_status_code = 200 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): def setUp(self):
super(KeyPairsSampleJsonTest, self).setUp() super(KeyPairsSampleJsonTest, self).setUp()
self.api.microversion = self.microversion self.api.microversion = self.microversion

View File

@ -13,11 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
@ -29,11 +26,6 @@ class LimitsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
# and V2.1 as the response are different. # and V2.1 as the response are different.
self.template = 'limit-get-resp' 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): def test_limits_get(self):
response = self._do_get('limits') response = self._do_get('limits')
self._verify_response(self.template, {}, response, 200) self._verify_response(self.template, {}, response, 200)

View File

@ -13,22 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class LockServerSamplesJsonTest(test_servers.ServersSampleBase): class LockServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-lock-server" 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): def setUp(self):
"""setUp Method for LockServer api samples extension """setUp Method for LockServer api samples extension

View File

@ -16,24 +16,13 @@
import mock import mock
from oslo_utils import versionutils from oslo_utils import versionutils
import nova.conf
from nova import objects from nova import objects
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase): class MigrateServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-migrate-server" 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): def setUp(self):
"""setUp Method for MigrateServer api samples extension """setUp Method for MigrateServer api samples extension

View File

@ -15,13 +15,10 @@
import datetime import datetime
import nova.conf
from nova import context from nova import context
from nova import objects from nova import objects
from nova.tests.functional.api_sample_tests import api_sample_base 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 # NOTE(ShaoHe Feng) here I can not use uuidsentinel, it generate a random
# UUID. The uuid in doc/api_samples files is fixed. # UUID. The uuid in doc/api_samples files is fixed.
@ -75,13 +72,6 @@ class MigrationsSamplesJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-migrations" 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): def setUp(self):
super(MigrationsSamplesJsonTest, self).setUp() super(MigrationsSamplesJsonTest, self).setUp()
self.stub_out('nova.compute.api.API.get_migrations', self.stub_out('nova.compute.api.API.get_migrations',

View File

@ -13,23 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class MultinicSampleJsonTest(test_servers.ServersSampleBase): class MultinicSampleJsonTest(test_servers.ServersSampleBase):
ADMIN_API = True ADMIN_API = True
extension_name = "os-multinic" 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): def _disable_instance_dns_manager(self):
# NOTE(markmc): it looks like multinic and instance_dns_manager are # NOTE(markmc): it looks like multinic and instance_dns_manager are
# incompatible. See: # incompatible. See:

View File

@ -13,24 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class MultipleCreateJsonTest(test_servers.ServersSampleBase): class MultipleCreateJsonTest(test_servers.ServersSampleBase):
extension_name = "os-multiple-create" 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): def test_multiple_create(self):
subs = { subs = {
'image_id': fake.get_valid_image_id(), 'image_id': fake.get_valid_image_id(),

View File

@ -13,12 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.api.openstack.compute import test_networks from nova.tests.unit.api.openstack.compute import test_networks
CONF = nova.conf.CONF
def _fixtures_passthrough(method_name): def _fixtures_passthrough(method_name):
# This compensates for how fixtures 3.x handles the signatures of # This compensates for how fixtures 3.x handles the signatures of
@ -43,15 +40,6 @@ class NetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-networks" 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): def setUp(self):
super(NetworksJsonTests, self).setUp() super(NetworksJsonTests, self).setUp()
self.stub_out("nova.network.api.API.get_all", self.stub_out("nova.network.api.API.get_all",

View File

@ -13,11 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21): class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
@ -26,17 +23,6 @@ class NetworksAssociateJsonTests(api_sample_base.ApiSampleTestBaseV21):
_sentinel = object() _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): def setUp(self):
super(NetworksAssociateJsonTests, self).setUp() super(NetworksAssociateJsonTests, self).setUp()

View File

@ -13,22 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class PauseServerSamplesJsonTest(test_servers.ServersSampleBase): class PauseServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-pause-server" 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): def setUp(self):
"""setUp Method for PauseServer api samples extension """setUp Method for PauseServer api samples extension

View File

@ -13,24 +13,13 @@
# under the License. # under the License.
from nova.compute import api as compute_api from nova.compute import api as compute_api
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase): class PreserveEphemeralOnRebuildJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-preserve-ephemeral-rebuild' 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): def _test_server_rebuild_preserve_ephemeral(self, value, resp_tpl=None):
uuid = self._post_server() uuid = self._post_server()
image = fake.get_valid_image_id() image = fake.get_valid_image_id()

View File

@ -13,25 +13,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class QuotaClassesSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): class QuotaClassesSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-quota-class-sets" extension_name = "os-quota-class-sets"
set_id = 'test_class' 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): def test_show_quota_classes(self):
# Get api sample to show quota classes. # Get api sample to show quota classes.
response = self._do_get('os-quota-class-sets/%s' % self.set_id) response = self._do_get('os-quota-class-sets/%s' % self.set_id)

View File

@ -13,30 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): class QuotaSetsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-quota-sets" 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): def test_show_quotas(self):
# Get api sample to show quotas. # Get api sample to show quotas.
response = self._do_get('os-quota-sets/fake_tenant') response = self._do_get('os-quota-sets/fake_tenant')

View File

@ -13,23 +13,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ConsolesSampleJsonTests(test_servers.ServersSampleBase): class ConsolesSampleJsonTests(test_servers.ServersSampleBase):
microversion = None microversion = None
extension_name = "os-remote-consoles" 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): def setUp(self):
super(ConsolesSampleJsonTests, self).setUp() super(ConsolesSampleJsonTests, self).setUp()
self.api.microversion = self.microversion self.api.microversion = self.microversion

View File

@ -13,32 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class RescueJsonTest(test_servers.ServersSampleBase): class RescueJsonTest(test_servers.ServersSampleBase):
extension_name = "os-rescue" 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): def _rescue(self, uuid):
req_subs = { req_subs = {
'password': 'MySecretPass' 'password': 'MySecretPass'

View File

@ -15,24 +15,13 @@
import uuid import uuid
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class SchedulerHintsJsonTest(api_sample_base.ApiSampleTestBaseV21): class SchedulerHintsJsonTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-scheduler-hints" 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): def test_scheduler_hints_post(self):
# Get api sample of scheduler hint post request. # Get api sample of scheduler hint post request.
subs = {'image_id': fake.get_valid_image_id(), subs = {'image_id': fake.get_valid_image_id(),

View File

@ -12,25 +12,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class SecurityGroupDefaultRulesSampleJsonTest( class SecurityGroupDefaultRulesSampleJsonTest(
api_sample_base.ApiSampleTestBaseV21): api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = 'os-security-group-default-rules' 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): def test_security_group_default_rules_create(self):
response = self._do_post('os-security-group-default-rules', response = self._do_post('os-security-group-default-rules',
'security-group-default-rules-create-req', 'security-group-default-rules-create-req',

View File

@ -13,12 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
import nova.tests.functional.api_samples_test_base as astb import nova.tests.functional.api_samples_test_base as astb
CONF = nova.conf.CONF
def fake_get(*args, **kwargs): def fake_get(*args, **kwargs):
nova_group = {} nova_group = {}
@ -63,21 +60,6 @@ def fake_create_security_group(self, context, name, description):
class SecurityGroupsJsonTest(test_servers.ServersSampleBase): class SecurityGroupsJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-security-groups' 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): def setUp(self):
self.flags(security_group_api=('neutron')) self.flags(security_group_api=('neutron'))
super(SecurityGroupsJsonTest, self).setUp() super(SecurityGroupsJsonTest, self).setUp()

View File

@ -13,23 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase): class ServerDiagnosticsSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-server-diagnostics" 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): def test_server_diagnostics_get(self):
uuid = self._post_server() uuid = self._post_server()
response = self._do_get('servers/%s/diagnostics' % uuid) response = self._do_get('servers/%s/diagnostics' % uuid)

View File

@ -12,24 +12,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ServerExternalEventsSamplesJsonTest(test_servers.ServersSampleBase): class ServerExternalEventsSamplesJsonTest(test_servers.ServersSampleBase):
ADMIN_API = True ADMIN_API = True
extension_name = "os-server-external-events" 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): def setUp(self):
"""setUp Method for AdminActions api samples extension """setUp Method for AdminActions api samples extension

View File

@ -13,22 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class ServerGroupsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21): class ServerGroupsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-server-groups" 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): def _get_create_subs(self):
return {'name': 'test'} return {'name': 'test'}

View File

@ -14,23 +14,12 @@
import mock import mock
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ServerPasswordSampleJsonTests(test_servers.ServersSampleBase): class ServerPasswordSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-server-password" 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") @mock.patch("nova.api.metadata.password.extract_password")
def test_get_password(self, mock_extract_password): def test_get_password(self, mock_extract_password):
password = ("xlozO3wLCBRWAa2yDjCCVx8vwNPypxnypmRYDa/zErlQ+EzPe1S/" password = ("xlozO3wLCBRWAa2yDjCCVx8vwNPypxnypmRYDa/zErlQ+EzPe1S/"

View File

@ -13,29 +13,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class ServerUsageSampleJsonTest(test_servers.ServersSampleBase): class ServerUsageSampleJsonTest(test_servers.ServersSampleBase):
extension_name = 'os-server-usage' 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): def setUp(self):
"""setUp method for server usage.""" """setUp method for server usage."""
super(ServerUsageSampleJsonTest, self).setUp() super(ServerUsageSampleJsonTest, self).setUp()

View File

@ -13,12 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21): class ServersSampleBase(api_sample_base.ApiSampleTestBaseV21):
extra_extensions_to_load = ["os-access-ips"] extra_extensions_to_load = ["os-access-ips"]
@ -71,18 +68,6 @@ class ServersSampleJsonTest(ServersSampleBase):
sample_dir = 'servers' sample_dir = 'servers'
microversion = None 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): def test_servers_post(self):
return self._post_server() return self._post_server()
@ -167,14 +152,6 @@ class ServersUpdateSampleJsonTest(ServersSampleBase):
class ServerSortKeysJsonTests(ServersSampleBase): class ServerSortKeysJsonTests(ServersSampleBase):
sample_dir = 'servers-sort' 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): def test_servers_list(self):
self._post_server() self._post_server()
response = self._do_get('servers?sort_key=display_name&sort_dir=asc') response = self._do_get('servers?sort_key=display_name&sort_dir=asc')
@ -294,14 +271,6 @@ class ServersActionsAllJsonTest(ServersActionsJsonTest):
class ServerStartStopJsonTest(ServersSampleBase): class ServerStartStopJsonTest(ServersSampleBase):
sample_dir = 'servers' 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): def _test_server_action(self, uuid, action, req_tpl):
response = self._do_post('servers/%s/action' % uuid, response = self._do_post('servers/%s/action' % uuid,
req_tpl, req_tpl,
@ -323,11 +292,6 @@ class ServersSampleMultiStatusJsonTest(ServersSampleBase):
sample_dir = 'servers' sample_dir = 'servers'
extra_extensions_to_load = ["os-access-ips"] 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): def test_servers_list(self):
uuid = self._post_server() uuid = self._post_server()
response = self._do_get('servers?status=active&status=error') response = self._do_get('servers?status=active&status=error')

View File

@ -15,31 +15,15 @@
from oslo_utils import fixture as utils_fixture 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.functional.api_sample_tests import api_sample_base
from nova.tests.unit.api.openstack.compute import test_services from nova.tests.unit.api.openstack.compute import test_services
CONF = nova.conf.CONF
class ServicesJsonTest(api_sample_base.ApiSampleTestBaseV21): class ServicesJsonTest(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-services" extension_name = "os-services"
microversion = None 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): def setUp(self):
super(ServicesJsonTest, self).setUp() super(ServicesJsonTest, self).setUp()
self.api.microversion = self.microversion self.api.microversion = self.microversion

View File

@ -23,13 +23,6 @@ CONF = nova.conf.CONF
class ShelveJsonTest(test_servers.ServersSampleBase): class ShelveJsonTest(test_servers.ServersSampleBase):
extension_name = "os-shelve" 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): def setUp(self):
super(ShelveJsonTest, self).setUp() super(ShelveJsonTest, self).setUp()
# Don't offload instance, so we can test the offload call. # Don't offload instance, so we can test the offload call.

View File

@ -17,24 +17,13 @@ import urllib
from oslo_utils import timeutils from oslo_utils import timeutils
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
import nova.tests.functional.api_samples_test_base as astb import nova.tests.functional.api_samples_test_base as astb
CONF = nova.conf.CONF
class SimpleTenantUsageSampleJsonTest(test_servers.ServersSampleBase): class SimpleTenantUsageSampleJsonTest(test_servers.ServersSampleBase):
extension_name = "os-simple-tenant-usage" 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): def setUp(self):
"""setUp method for simple tenant usage.""" """setUp method for simple tenant usage."""
super(SimpleTenantUsageSampleJsonTest, self).setUp() super(SimpleTenantUsageSampleJsonTest, self).setUp()

View File

@ -12,22 +12,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase): class SuspendServerSamplesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-suspend-server" 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): def setUp(self):
"""setUp Method for SuspendServer api samples extension """setUp Method for SuspendServer api samples extension

View File

@ -26,13 +26,6 @@ class TenantNetworksJsonTests(api_sample_base.ApiSampleTestBaseV21):
ADMIN_API = True ADMIN_API = True
extension_name = "os-tenant-networks" 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): def setUp(self):
super(TenantNetworksJsonTests, self).setUp() super(TenantNetworksJsonTests, self).setUp()
CONF.set_override("enable_network_quota", True) CONF.set_override("enable_network_quota", True)

View File

@ -15,23 +15,13 @@
import base64 import base64
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base from nova.tests.functional.api_sample_tests import api_sample_base
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
CONF = nova.conf.CONF
class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV21): class UserDataJsonTest(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-user-data" 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): def test_user_data_post(self):
user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n' user_data_contents = '#!/bin/bash\n/bin/su\necho "I am in you!"\n'
user_data = base64.b64encode(user_data_contents) user_data = base64.b64encode(user_data_contents)

View File

@ -13,11 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers from nova.tests.functional.api_sample_tests import test_servers
CONF = nova.conf.CONF
class VirtualInterfacesJsonTest(test_servers.ServersSampleBase): class VirtualInterfacesJsonTest(test_servers.ServersSampleBase):
extension_name = "os-virtual-interfaces" extension_name = "os-virtual-interfaces"
@ -28,11 +25,6 @@ class VirtualInterfacesJsonTest(test_servers.ServersSampleBase):
if self.api_major_version == 'v2': if self.api_major_version == 'v2':
self.template = 'vifs-list-resp-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): def test_vifs_list(self):
uuid = self._post_server() uuid = self._post_server()

View File

@ -15,7 +15,6 @@
import datetime import datetime
import nova.conf
from nova import context from nova import context
from nova import objects from nova import objects
from nova.tests.functional.api_sample_tests import api_sample_base 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_block_device
from nova.tests.unit import fake_instance from nova.tests.unit import fake_instance
CONF = nova.conf.CONF
class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21): class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
extension_name = "os-volumes" extension_name = "os-volumes"
@ -36,13 +33,6 @@ class SnapshotsSampleJsonTests(api_sample_base.ApiSampleTestBaseV21):
'volume_id': '521752a6-acf6-4b2d-bc7a-119f9148cd8c' '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): def setUp(self):
super(SnapshotsSampleJsonTests, self).setUp() super(SnapshotsSampleJsonTests, self).setUp()
self.stub_out("nova.volume.cinder.API.get_all_snapshots", 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): class VolumesSampleJsonTest(test_servers.ServersSampleBase):
extension_name = "os-volumes" 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): def setUp(self):
super(VolumesSampleJsonTest, self).setUp() super(VolumesSampleJsonTest, self).setUp()
fakes.stub_out_networking(self) 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) 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): 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.get', fakes.stub_volume_get)
self.stub_out('nova.volume.cinder.API.check_attach', self.stub_out('nova.volume.cinder.API.check_attach',