Small cleanup in "test_data"
This patch set replaces a few method imports with module imports in "openstack_dashboard/test/test_data". Fixes bug 1215996 Change-Id: I3268d61044f31e7adca5ae752b4768df0e7fbbec
This commit is contained in:
parent
71ddcb0025
commit
17f18f6316
@ -16,12 +16,12 @@ from cinderclient.v1 import quotas
|
||||
from openstack_dashboard.api import base
|
||||
from openstack_dashboard.usage import quotas as usage_quotas
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def data(TEST):
|
||||
TEST.cinder_quotas = TestDataContainer()
|
||||
TEST.cinder_quota_usages = TestDataContainer()
|
||||
TEST.cinder_quotas = utils.TestDataContainer()
|
||||
TEST.cinder_quota_usages = utils.TestDataContainer()
|
||||
|
||||
# Quota Sets
|
||||
quota_data = dict(volumes='1',
|
||||
|
@ -12,15 +12,14 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from glanceclient.v1.images import Image # noqa
|
||||
from glanceclient.v1.images import ImageManager # noqa
|
||||
from glanceclient.v1 import images
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def data(TEST):
|
||||
TEST.images = TestDataContainer()
|
||||
TEST.snapshots = TestDataContainer()
|
||||
TEST.images = utils.TestDataContainer()
|
||||
TEST.snapshots = utils.TestDataContainer()
|
||||
|
||||
# Snapshots
|
||||
snapshot_dict = {'name': u'snapshot',
|
||||
@ -47,11 +46,11 @@ def data(TEST):
|
||||
'properties': {'image_type': u'snapshot'},
|
||||
'is_public': False,
|
||||
'protected': False}
|
||||
snapshot = Image(ImageManager(None), snapshot_dict)
|
||||
snapshot = images.Image(images.ImageManager(None), snapshot_dict)
|
||||
TEST.snapshots.add(snapshot)
|
||||
snapshot = Image(ImageManager(None), snapshot_dict_no_owner)
|
||||
snapshot = images.Image(images.ImageManager(None), snapshot_dict_no_owner)
|
||||
TEST.snapshots.add(snapshot)
|
||||
snapshot = Image(ImageManager(None), snapshot_dict_queued)
|
||||
snapshot = images.Image(images.ImageManager(None), snapshot_dict_queued)
|
||||
TEST.snapshots.add(snapshot)
|
||||
|
||||
# Images
|
||||
@ -64,7 +63,7 @@ def data(TEST):
|
||||
'properties': {'image_type': u'image'},
|
||||
'is_public': True,
|
||||
'protected': False}
|
||||
public_image = Image(ImageManager(None), image_dict)
|
||||
public_image = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
image_dict = {'id': 'a001c047-22f8-47d0-80a1-8ec94a9524fe',
|
||||
'name': 'private_image',
|
||||
@ -74,7 +73,7 @@ def data(TEST):
|
||||
'container_format': 'aki',
|
||||
'is_public': False,
|
||||
'protected': False}
|
||||
private_image = Image(ImageManager(None), image_dict)
|
||||
private_image = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
image_dict = {'id': 'd6936c86-7fec-474a-85c5-5e467b371c3c',
|
||||
'name': 'protected_images',
|
||||
@ -85,7 +84,7 @@ def data(TEST):
|
||||
'properties': {'image_type': u'image'},
|
||||
'is_public': True,
|
||||
'protected': True}
|
||||
protected_image = Image(ImageManager(None), image_dict)
|
||||
protected_image = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
image_dict = {'id': '278905a6-4b52-4d1e-98f9-8c57bb25ba32',
|
||||
'name': 'public_image 2',
|
||||
@ -96,7 +95,7 @@ def data(TEST):
|
||||
'properties': {'image_type': u'image'},
|
||||
'is_public': True,
|
||||
'protected': False}
|
||||
public_image2 = Image(ImageManager(None), image_dict)
|
||||
public_image2 = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
image_dict = {'id': '710a1acf-a3e3-41dd-a32d-5d6b6c86ea10',
|
||||
'name': 'private_image 2',
|
||||
@ -106,7 +105,7 @@ def data(TEST):
|
||||
'container_format': 'aki',
|
||||
'is_public': False,
|
||||
'protected': False}
|
||||
private_image2 = Image(ImageManager(None), image_dict)
|
||||
private_image2 = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
image_dict = {'id': '7cd892fd-5652-40f3-a450-547615680132',
|
||||
'name': 'private_image 3',
|
||||
@ -116,7 +115,7 @@ def data(TEST):
|
||||
'container_format': 'aki',
|
||||
'is_public': False,
|
||||
'protected': False}
|
||||
private_image3 = Image(ImageManager(None), image_dict)
|
||||
private_image3 = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
# A shared image. Not public and not local tenant.
|
||||
image_dict = {'id': 'c8756975-7a3b-4e43-b7f7-433576112849',
|
||||
@ -127,7 +126,7 @@ def data(TEST):
|
||||
'container_format': 'aki',
|
||||
'is_public': False,
|
||||
'protected': False}
|
||||
shared_image1 = Image(ImageManager(None), image_dict)
|
||||
shared_image1 = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
# "Official" image. Public and tenant matches an entry
|
||||
# in IMAGES_LIST_FILTER_TENANTS.
|
||||
@ -139,7 +138,7 @@ def data(TEST):
|
||||
'container_format': 'aki',
|
||||
'is_public': True,
|
||||
'protected': False}
|
||||
official_image1 = Image(ImageManager(None), image_dict)
|
||||
official_image1 = images.Image(images.ImageManager(None), image_dict)
|
||||
|
||||
TEST.images.add(public_image, private_image, protected_image,
|
||||
public_image2, private_image2, private_image3,
|
||||
|
@ -12,10 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from heatclient.v1.stacks import Stack # noqa
|
||||
from heatclient.v1.stacks import StackManager # noqa
|
||||
from heatclient.v1 import stacks
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
# A slightly hacked up copy of a sample cloudformation template for testing.
|
||||
@ -314,8 +313,8 @@ class Template(object):
|
||||
|
||||
|
||||
def data(TEST):
|
||||
TEST.stacks = TestDataContainer()
|
||||
TEST.stack_templates = TestDataContainer()
|
||||
TEST.stacks = utils.TestDataContainer()
|
||||
TEST.stack_templates = utils.TestDataContainer()
|
||||
|
||||
# Stacks
|
||||
stack1 = {
|
||||
@ -334,7 +333,7 @@ def data(TEST):
|
||||
"stack_status": "CREATE_COMPLETE",
|
||||
"id": "05b4f39f-ea96-4d91-910c-e758c078a089"
|
||||
}
|
||||
stack = Stack(StackManager(None), stack1)
|
||||
stack = stacks.Stack(stacks.StackManager(None), stack1)
|
||||
TEST.stacks.add(stack)
|
||||
|
||||
TEST.stack_templates.add(Template(TEMPLATE, VALIDATE))
|
||||
|
@ -17,7 +17,7 @@ from datetime import timedelta # noqa
|
||||
from django.conf import settings # noqa
|
||||
from django.utils import datetime_safe
|
||||
|
||||
from keystoneclient.access import AccessInfo # noqa
|
||||
from keystoneclient import access
|
||||
from keystoneclient.v2_0 import ec2
|
||||
from keystoneclient.v2_0 import roles
|
||||
from keystoneclient.v2_0 import tenants
|
||||
@ -25,9 +25,9 @@ from keystoneclient.v2_0 import users
|
||||
from keystoneclient.v3 import domains
|
||||
from keystoneclient.v3 import groups
|
||||
|
||||
from openstack_auth.user import Token # noqa
|
||||
from openstack_auth import user as auth_user
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
# Dummy service catalog with all service.
|
||||
@ -111,13 +111,13 @@ SERVICE_CATALOG = [
|
||||
|
||||
def data(TEST):
|
||||
TEST.service_catalog = SERVICE_CATALOG
|
||||
TEST.tokens = TestDataContainer()
|
||||
TEST.domains = TestDataContainer()
|
||||
TEST.users = TestDataContainer()
|
||||
TEST.groups = TestDataContainer()
|
||||
TEST.tenants = TestDataContainer()
|
||||
TEST.roles = TestDataContainer()
|
||||
TEST.ec2 = TestDataContainer()
|
||||
TEST.tokens = utils.TestDataContainer()
|
||||
TEST.domains = utils.TestDataContainer()
|
||||
TEST.users = utils.TestDataContainer()
|
||||
TEST.groups = utils.TestDataContainer()
|
||||
TEST.tenants = utils.TestDataContainer()
|
||||
TEST.roles = utils.TestDataContainer()
|
||||
TEST.ec2 = utils.TestDataContainer()
|
||||
|
||||
admin_role_dict = {'id': '1',
|
||||
'name': 'admin'}
|
||||
@ -248,7 +248,7 @@ def data(TEST):
|
||||
}
|
||||
}
|
||||
|
||||
scoped_access_info = AccessInfo.factory(resp=None,
|
||||
scoped_access_info = access.AccessInfo.factory(resp=None,
|
||||
body=scoped_token_dict)
|
||||
|
||||
unscoped_token_dict = {
|
||||
@ -263,11 +263,11 @@ def data(TEST):
|
||||
'serviceCatalog': TEST.service_catalog
|
||||
}
|
||||
}
|
||||
unscoped_access_info = AccessInfo.factory(resp=None,
|
||||
unscoped_access_info = access.AccessInfo.factory(resp=None,
|
||||
body=unscoped_token_dict)
|
||||
|
||||
scoped_token = Token(scoped_access_info)
|
||||
unscoped_token = Token(unscoped_access_info)
|
||||
scoped_token = auth_user.Token(scoped_access_info)
|
||||
unscoped_token = auth_user.Token(unscoped_access_info)
|
||||
TEST.tokens.add(scoped_token, unscoped_token)
|
||||
TEST.token = scoped_token # your "current" token.
|
||||
TEST.tokens.scoped_token = scoped_token
|
||||
|
@ -19,35 +19,35 @@ from openstack_dashboard.api import lbaas
|
||||
|
||||
from openstack_dashboard.api import neutron
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def data(TEST):
|
||||
# data returned by openstack_dashboard.api.neutron wrapper
|
||||
TEST.networks = TestDataContainer()
|
||||
TEST.subnets = TestDataContainer()
|
||||
TEST.ports = TestDataContainer()
|
||||
TEST.routers = TestDataContainer()
|
||||
TEST.q_floating_ips = TestDataContainer()
|
||||
TEST.q_secgroups = TestDataContainer()
|
||||
TEST.q_secgroup_rules = TestDataContainer()
|
||||
TEST.pools = TestDataContainer()
|
||||
TEST.vips = TestDataContainer()
|
||||
TEST.members = TestDataContainer()
|
||||
TEST.monitors = TestDataContainer()
|
||||
TEST.networks = utils.TestDataContainer()
|
||||
TEST.subnets = utils.TestDataContainer()
|
||||
TEST.ports = utils.TestDataContainer()
|
||||
TEST.routers = utils.TestDataContainer()
|
||||
TEST.q_floating_ips = utils.TestDataContainer()
|
||||
TEST.q_secgroups = utils.TestDataContainer()
|
||||
TEST.q_secgroup_rules = utils.TestDataContainer()
|
||||
TEST.pools = utils.TestDataContainer()
|
||||
TEST.vips = utils.TestDataContainer()
|
||||
TEST.members = utils.TestDataContainer()
|
||||
TEST.monitors = utils.TestDataContainer()
|
||||
|
||||
# data return by neutronclient
|
||||
TEST.api_networks = TestDataContainer()
|
||||
TEST.api_subnets = TestDataContainer()
|
||||
TEST.api_ports = TestDataContainer()
|
||||
TEST.api_routers = TestDataContainer()
|
||||
TEST.api_q_floating_ips = TestDataContainer()
|
||||
TEST.api_q_secgroups = TestDataContainer()
|
||||
TEST.api_q_secgroup_rules = TestDataContainer()
|
||||
TEST.api_pools = TestDataContainer()
|
||||
TEST.api_vips = TestDataContainer()
|
||||
TEST.api_members = TestDataContainer()
|
||||
TEST.api_monitors = TestDataContainer()
|
||||
TEST.api_networks = utils.TestDataContainer()
|
||||
TEST.api_subnets = utils.TestDataContainer()
|
||||
TEST.api_ports = utils.TestDataContainer()
|
||||
TEST.api_routers = utils.TestDataContainer()
|
||||
TEST.api_q_floating_ips = utils.TestDataContainer()
|
||||
TEST.api_q_secgroups = utils.TestDataContainer()
|
||||
TEST.api_q_secgroup_rules = utils.TestDataContainer()
|
||||
TEST.api_pools = utils.TestDataContainer()
|
||||
TEST.api_vips = utils.TestDataContainer()
|
||||
TEST.api_members = utils.TestDataContainer()
|
||||
TEST.api_monitors = utils.TestDataContainer()
|
||||
|
||||
#------------------------------------------------------------
|
||||
# 1st network
|
||||
|
@ -36,7 +36,7 @@ from openstack_dashboard.api import base
|
||||
from openstack_dashboard.api import nova
|
||||
from openstack_dashboard.usage import quotas as usage_quotas
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
SERVER_DATA = """
|
||||
@ -147,31 +147,31 @@ USAGE_DATA = """
|
||||
|
||||
|
||||
def data(TEST):
|
||||
TEST.servers = TestDataContainer()
|
||||
TEST.flavors = TestDataContainer()
|
||||
TEST.keypairs = TestDataContainer()
|
||||
TEST.security_groups = TestDataContainer()
|
||||
TEST.security_groups_uuid = TestDataContainer()
|
||||
TEST.security_group_rules = TestDataContainer()
|
||||
TEST.security_group_rules_uuid = TestDataContainer()
|
||||
TEST.volumes = TestDataContainer()
|
||||
TEST.quotas = TestDataContainer()
|
||||
TEST.quota_usages = TestDataContainer()
|
||||
TEST.floating_ips = TestDataContainer()
|
||||
TEST.floating_ips_uuid = TestDataContainer()
|
||||
TEST.usages = TestDataContainer()
|
||||
TEST.certs = TestDataContainer()
|
||||
TEST.volume_snapshots = TestDataContainer()
|
||||
TEST.volume_types = TestDataContainer()
|
||||
TEST.availability_zones = TestDataContainer()
|
||||
TEST.hypervisors = TestDataContainer()
|
||||
TEST.services = TestDataContainer()
|
||||
TEST.aggregates = TestDataContainer()
|
||||
TEST.servers = utils.TestDataContainer()
|
||||
TEST.flavors = utils.TestDataContainer()
|
||||
TEST.keypairs = utils.TestDataContainer()
|
||||
TEST.security_groups = utils.TestDataContainer()
|
||||
TEST.security_groups_uuid = utils.TestDataContainer()
|
||||
TEST.security_group_rules = utils.TestDataContainer()
|
||||
TEST.security_group_rules_uuid = utils.TestDataContainer()
|
||||
TEST.volumes = utils.TestDataContainer()
|
||||
TEST.quotas = utils.TestDataContainer()
|
||||
TEST.quota_usages = utils.TestDataContainer()
|
||||
TEST.floating_ips = utils.TestDataContainer()
|
||||
TEST.floating_ips_uuid = utils.TestDataContainer()
|
||||
TEST.usages = utils.TestDataContainer()
|
||||
TEST.certs = utils.TestDataContainer()
|
||||
TEST.volume_snapshots = utils.TestDataContainer()
|
||||
TEST.volume_types = utils.TestDataContainer()
|
||||
TEST.availability_zones = utils.TestDataContainer()
|
||||
TEST.hypervisors = utils.TestDataContainer()
|
||||
TEST.services = utils.TestDataContainer()
|
||||
TEST.aggregates = utils.TestDataContainer()
|
||||
|
||||
# Data return by novaclient.
|
||||
# It is used if API layer does data conversion.
|
||||
TEST.api_floating_ips = TestDataContainer()
|
||||
TEST.api_floating_ips_uuid = TestDataContainer()
|
||||
TEST.api_floating_ips = utils.TestDataContainer()
|
||||
TEST.api_floating_ips_uuid = utils.TestDataContainer()
|
||||
|
||||
# Volumes
|
||||
volume = volumes.Volume(volumes.VolumeManager(None),
|
||||
|
@ -15,12 +15,12 @@
|
||||
from openstack_dashboard.api import swift
|
||||
from openstack_dashboard.openstack.common import timeutils
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def data(TEST):
|
||||
TEST.containers = TestDataContainer()
|
||||
TEST.objects = TestDataContainer()
|
||||
TEST.containers = utils.TestDataContainer()
|
||||
TEST.objects = utils.TestDataContainer()
|
||||
|
||||
container_dict_1 = {"name": u"container_one\u6346",
|
||||
"container_object_count": 2,
|
||||
|
Loading…
x
Reference in New Issue
Block a user