Merge "Refactor verify_get tests"

This commit is contained in:
Jenkins 2015-06-28 16:08:42 +00:00 committed by Gerrit Code Review
commit 6710667419
14 changed files with 68 additions and 225 deletions

View File

@ -23,10 +23,7 @@ class TestVolumeProxy(test_proxy_base.TestProxyBase):
self.proxy = _proxy.Proxy(self.session)
def test_snapshot_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_snapshot,
method_args=["resource_or_id"],
expected_args=[snapshot.Snapshot, "resource_or_id"])
self.verify_get(self.proxy.get_snapshot, snapshot.Snapshot)
def test_snapshot_create_attrs(self):
self.verify_create(self.proxy.create_snapshot, snapshot.Snapshot)
@ -40,10 +37,7 @@ class TestVolumeProxy(test_proxy_base.TestProxyBase):
snapshot.Snapshot, True)
def test_type_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_type,
method_args=["resource_or_id"],
expected_args=[type.Type, "resource_or_id"])
self.verify_get(self.proxy.get_type, type.Type)
def test_type_create_attrs(self):
self.verify_create(self.proxy.create_type, type.Type)
@ -55,10 +49,7 @@ class TestVolumeProxy(test_proxy_base.TestProxyBase):
self.verify_delete(self.proxy.delete_type, type.Type, True)
def test_volume_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_volume,
method_args=["resource_or_id"],
expected_args=[volume.Volume, "resource_or_id"])
self.verify_get(self.proxy.get_volume, volume.Volume)
def test_volume_create_attrs(self):
self.verify_create(self.proxy.create_volume, volume.Volume)

View File

@ -34,10 +34,7 @@ class TestClusterProxy(test_proxy_base.TestProxyBase):
self.proxy.find_cluster)
def test_cluster_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_cluster,
method_args=["resource_or_id"],
expected_args=[cluster.Cluster, "resource_or_id"])
self.verify_get(self.proxy.get_cluster, cluster.Cluster)
def test_clusters(self):
self.verify_list(self.proxy.clusters, cluster.Cluster,

View File

@ -49,10 +49,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
self.proxy.find_flavor)
def test_flavor_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_flavor,
method_args=["resource_or_id"],
expected_args=[flavor.Flavor, "resource_or_id"])
self.verify_get(self.proxy.get_flavor, flavor.Flavor)
def test_flavors_detailed(self):
self.verify_list(self.proxy.flavors, flavor.FlavorDetail,
@ -80,10 +77,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
self.proxy.find_image)
def test_image_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_image,
method_args=["resource_or_id"],
expected_args=[image.Image, "resource_or_id"])
self.verify_get(self.proxy.get_image, image.Image)
def test_images_detailed(self):
self.verify_list(self.proxy.images, image.ImageDetail,
@ -111,10 +105,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
self.proxy.find_keypair)
def test_keypair_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_keypair,
method_args=["resource_or_id"],
expected_args=[keypair.Keypair, "resource_or_id"])
self.verify_get(self.proxy.get_keypair, keypair.Keypair)
def test_keypairs(self):
self.verify_list(self.proxy.keypairs, keypair.Keypair,
@ -124,9 +115,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
self.verify_update(self.proxy.update_keypair, keypair.Keypair)
def test_limits_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_limits,
expected_args=[limits.Limits])
self.verify_get(self.proxy.get_limits, limits.Limits, value=[])
def test_server_interface_create(self):
self.verify_create(self.proxy.create_server_interface,
@ -146,11 +135,8 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
self.proxy.find_server_interface)
def test_server_interface_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_server_interface,
method_args=["resource_or_id"],
expected_args=[server_interface.ServerInterface,
"resource_or_id"])
self.verify_get(self.proxy.get_server_interface,
server_interface.ServerInterface)
def test_server_interfaces(self):
self.verify_list(self.proxy.server_interfaces,
@ -183,10 +169,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
self.proxy.find_server)
def test_server_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_server,
method_args=["resource_or_id"],
expected_args=[server.Server, "resource_or_id"])
self.verify_get(self.proxy.get_server, server.Server)
def test_servers_detailed(self):
self.verify_list(self.proxy.servers, server.ServerDetail,

View File

@ -43,20 +43,14 @@ class TestDatabaseProxy(test_proxy_base.TestProxyBase):
paginated=False)
def test_database_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_database,
method_args=["resource_or_id"],
expected_args=[database.Database, "resource_or_id"])
self.verify_get(self.proxy.get_database, database.Database)
def test_flavor_find(self):
self.verify_find('openstack.database.v1.flavor.Flavor.find',
self.proxy.find_flavor)
def test_flavor_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_flavor,
method_args=["resource_or_id"],
expected_args=[flavor.Flavor, "resource_or_id"])
self.verify_get(self.proxy.get_flavor, flavor.Flavor)
def test_flavors(self):
self.verify_list(self.proxy.flavors, flavor.Flavor,
@ -78,10 +72,7 @@ class TestDatabaseProxy(test_proxy_base.TestProxyBase):
self.proxy.find_instance)
def test_instance_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_instance,
method_args=["resource_or_id"],
expected_args=[instance.Instance, "resource_or_id"])
self.verify_get(self.proxy.get_instance, instance.Instance)
def test_instances(self):
self.verify_list(self.proxy.instances, instance.Instance,
@ -107,7 +98,4 @@ class TestDatabaseProxy(test_proxy_base.TestProxyBase):
self.verify_list(self.proxy.users, user.User, paginated=False)
def test_user_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_user,
method_args=["resource_or_id"],
expected_args=[user.User, "resource_or_id"])
self.verify_get(self.proxy.get_user, user.User)

View File

@ -36,10 +36,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_role)
def test_role_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_role,
method_args=["resource_or_id"],
expected_args=[role.Role, "resource_or_id"])
self.verify_get(self.proxy.get_role, role.Role)
def test_roles(self):
self.verify_list(self.proxy.roles, role.Role, paginated=True)
@ -61,10 +58,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_tenant)
def test_tenant_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_tenant,
method_args=["resource_or_id"],
expected_args=[tenant.Tenant, "resource_or_id"])
self.verify_get(self.proxy.get_tenant, tenant.Tenant)
def test_tenants(self):
self.verify_list(self.proxy.tenants, tenant.Tenant, paginated=True)
@ -86,10 +80,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_user)
def test_user_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_user,
method_args=["resource_or_id"],
expected_args=[user.User, "resource_or_id"])
self.verify_get(self.proxy.get_user, user.User)
def test_users(self):
self.verify_list(self.proxy.users, user.User, paginated=True)

View File

@ -45,11 +45,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_credential)
def test_credential_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_credential,
method_args=["resource_or_id"],
expected_args=[credential.Credential,
"resource_or_id"])
self.verify_get(self.proxy.get_credential, credential.Credential)
def test_credentials(self):
self.verify_list(self.proxy.credentials, credential.Credential,
@ -72,10 +68,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_domain)
def test_domain_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_domain,
method_args=["resource_or_id"],
expected_args=[domain.Domain, "resource_or_id"])
self.verify_get(self.proxy.get_domain, domain.Domain)
def test_domains(self):
self.verify_list(self.proxy.domains, domain.Domain, paginated=False)
@ -99,10 +92,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_endpoint)
def test_endpoint_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_endpoint,
method_args=["resource_or_id"],
expected_args=[endpoint.Endpoint, "resource_or_id"])
self.verify_get(self.proxy.get_endpoint, endpoint.Endpoint)
def test_endpoints(self):
self.verify_list(self.proxy.endpoints, endpoint.Endpoint,
@ -125,10 +115,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_group)
def test_group_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_group,
method_args=["resource_or_id"],
expected_args=[group.Group, "resource_or_id"])
self.verify_get(self.proxy.get_group, group.Group)
def test_groups(self):
self.verify_list(self.proxy.groups, group.Group, paginated=False)
@ -150,10 +137,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_policy)
def test_policy_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_policy,
method_args=["resource_or_id"],
expected_args=[policy.Policy, "resource_or_id"])
self.verify_get(self.proxy.get_policy, policy.Policy)
def test_policies(self):
self.verify_list(self.proxy.policies, policy.Policy, paginated=False)
@ -175,10 +159,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_project)
def test_project_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_project,
method_args=["resource_or_id"],
expected_args=[project.Project, "resource_or_id"])
self.verify_get(self.proxy.get_project, project.Project)
def test_projects(self):
self.verify_list(self.proxy.projects, project.Project, paginated=False)
@ -200,10 +181,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_service)
def test_service_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_service,
method_args=["resource_or_id"],
expected_args=[service.Service, "resource_or_id"])
self.verify_get(self.proxy.get_service, service.Service)
def test_services(self):
self.verify_list(self.proxy.services, service.Service, paginated=False)
@ -225,10 +203,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_user)
def test_user_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_user,
method_args=["resource_or_id"],
expected_args=[user.User, "resource_or_id"])
self.verify_get(self.proxy.get_user, user.User)
def test_users(self):
self.verify_list(self.proxy.users, user.User, paginated=False)
@ -250,10 +225,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
self.proxy.find_trust)
def test_trust_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_trust,
method_args=["resource_or_id"],
expected_args=[trust.Trust, "resource_or_id"])
self.verify_get(self.proxy.get_trust, trust.Trust)
def test_trusts(self):
self.verify_list(self.proxy.trusts, trust.Trust, paginated=False)

View File

@ -34,10 +34,7 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
self.proxy.find_image)
def test_image_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_image,
method_args=["resource_or_id"],
expected_args=[image.Image, "resource_or_id"])
self.verify_get(self.proxy.get_image, image.Image)
def test_images(self):
self.verify_list(self.proxy.images, image.Image, paginated=True)

View File

@ -35,10 +35,7 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
self.verify_update(self.proxy.update_image, image.Image)
def test_image_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_image,
method_args=["resource_or_id"],
expected_args=[image.Image, "resource_or_id"])
self.verify_get(self.proxy.get_image, image.Image)
def test_images(self):
self.verify_list(self.proxy.images, image.Image, paginated=True)
@ -56,10 +53,7 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
self.verify_update(self.proxy.update_member, member.Member)
def test_member_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_member,
method_args=["resource_or_id"],
expected_args=[member.Member, "resource_or_id"])
self.verify_get(self.proxy.get_member, member.Member)
def test_members(self):
self.verify_list(self.proxy.members, member.Member, paginated=False)

View File

@ -38,10 +38,7 @@ class TestKeystoreProxy(test_proxy_base.TestProxyBase):
self.proxy.find_container)
def test_container_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_container,
method_args=["resource_or_id"],
expected_args=[container.Container, "resource_or_id"])
self.verify_get(self.proxy.get_container, container.Container)
def test_containers(self):
self.verify_list(self.proxy.containers, container.Container,
@ -64,10 +61,7 @@ class TestKeystoreProxy(test_proxy_base.TestProxyBase):
self.proxy.find_order)
def test_order_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_order,
method_args=["resource_or_id"],
expected_args=[order.Order, "resource_or_id"])
self.verify_get(self.proxy.get_order, order.Order)
def test_orders(self):
self.verify_list(self.proxy.orders, order.Order, paginated=False)
@ -89,10 +83,7 @@ class TestKeystoreProxy(test_proxy_base.TestProxyBase):
self.proxy.find_secret)
def test_secret_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_secret,
method_args=["resource_or_id"],
expected_args=[secret.Secret, "resource_or_id"])
self.verify_get(self.proxy.get_secret, secret.Secret)
def test_secrets(self):
self.verify_list(self.proxy.secrets, secret.Secret, paginated=False)

View File

@ -62,11 +62,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_ip)
def test_floating_ip_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_ip,
method_args=["resource_or_id"],
expected_args=[floating_ip.FloatingIP,
"resource_or_id"])
self.verify_get(self.proxy.get_ip, floating_ip.FloatingIP)
def test_ips(self):
self.verify_list(self.proxy.ips, floating_ip.FloatingIP,
@ -93,11 +89,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_health_monitor)
def test_health_monitor_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_health_monitor,
method_args=["resource_or_id"],
expected_args=[health_monitor.HealthMonitor,
"resource_or_id"])
self.verify_get(self.proxy.get_health_monitor,
health_monitor.HealthMonitor)
def test_health_monitors(self):
self.verify_list(self.proxy.health_monitors,
@ -124,10 +117,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_listener)
def test_listener_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_listener,
method_args=["resource_or_id"],
expected_args=[listener.Listener, "resource_or_id"])
self.verify_get(self.proxy.get_listener, listener.Listener)
def test_listeners(self):
self.verify_list(self.proxy.listeners, listener.Listener,
@ -154,11 +144,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_load_balancer)
def test_load_balancer_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_load_balancer,
method_args=["resource_or_id"],
expected_args=[load_balancer.LoadBalancer,
"resource_or_id"])
self.verify_get(self.proxy.get_load_balancer,
load_balancer.LoadBalancer)
def test_load_balancers(self):
self.verify_list(self.proxy.load_balancers,
@ -187,11 +174,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_metering_label)
def test_metering_label_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_metering_label,
method_args=["resource_or_id"],
expected_args=[metering_label.MeteringLabel,
"resource_or_id"])
self.verify_get(self.proxy.get_metering_label,
metering_label.MeteringLabel)
def test_metering_labels(self):
self.verify_list(self.proxy.metering_labels,
@ -220,11 +204,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_metering_label_rule)
def test_metering_label_rule_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_metering_label_rule,
method_args=["resource_or_id"],
expected_args=[metering_label_rule.MeteringLabelRule,
"resource_or_id"])
self.verify_get(self.proxy.get_metering_label_rule,
metering_label_rule.MeteringLabelRule)
def test_metering_label_rules(self):
self.verify_list(self.proxy.metering_label_rules,
@ -249,10 +230,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_network)
def test_network_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_network,
method_args=["resource_or_id"],
expected_args=[network.Network, "resource_or_id"])
self.verify_get(self.proxy.get_network, network.Network)
def test_networks(self):
self.verify_list(self.proxy.networks, network.Network,
@ -280,12 +258,12 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_pool_member, {"pool_id": "test_id"})
def test_pool_member_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_pool_member,
method_args=["resource_or_id", "test_id"],
expected_args=[pool_member.PoolMember,
"resource_or_id"],
expected_kwargs={"path_args": {"pool_id": "test_id"}})
self._verify2('openstack.proxy.BaseProxy._get',
self.proxy.get_pool_member,
method_args=["resource_or_id", "test_id"],
expected_args=[pool_member.PoolMember,
"resource_or_id"],
expected_kwargs={"path_args": {"pool_id": "test_id"}})
def test_pool_members(self):
self.verify_list(self.proxy.pool_members, pool_member.PoolMember,
@ -311,10 +289,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_pool)
def test_pool_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_pool,
method_args=["resource_or_id"],
expected_args=[pool.Pool, "resource_or_id"])
self.verify_get(self.proxy.get_pool, pool.Pool)
def test_pools(self):
self.verify_list(self.proxy.pools, pool.Pool, paginated=False)
@ -336,10 +311,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_port)
def test_port_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_port,
method_args=["resource_or_id"],
expected_args=[port.Port, "resource_or_id"])
self.verify_get(self.proxy.get_port, port.Port)
def test_ports(self):
self.verify_list(self.proxy.ports, port.Port, paginated=False)
@ -364,10 +336,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_router)
def test_router_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_router,
method_args=["resource_or_id"],
expected_args=[router.Router, "resource_or_id"])
self.verify_get(self.proxy.get_router, router.Router)
def test_routers(self):
self.verify_list(self.proxy.routers, router.Router, paginated=False)
@ -393,11 +362,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_security_group)
def test_security_group_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_security_group,
method_args=["resource_or_id"],
expected_args=[security_group.SecurityGroup,
"resource_or_id"])
self.verify_get(self.proxy.get_security_group,
security_group.SecurityGroup)
def test_security_groups(self):
self.verify_list(self.proxy.security_groups,
@ -467,11 +433,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_security_group_rule)
def test_security_group_rule_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_security_group_rule,
method_args=["resource_or_id"],
expected_args=[security_group_rule.SecurityGroupRule,
"resource_or_id"])
self.verify_get(self.proxy.get_security_group_rule,
security_group_rule.SecurityGroupRule)
def test_security_group_rules(self):
self.verify_list(self.proxy.security_group_rules,
@ -496,10 +459,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_subnet)
def test_subnet_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_subnet,
method_args=["resource_or_id"],
expected_args=[subnet.Subnet, "resource_or_id"])
self.verify_get(self.proxy.get_subnet, subnet.Subnet)
def test_subnets(self):
self.verify_list(self.proxy.subnets, subnet.Subnet, paginated=False)
@ -524,11 +484,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
self.proxy.find_vpn_service)
def test_vpn_service_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_vpn_service,
method_args=["resource_or_id"],
expected_args=[vpn_service.VPNService,
"resource_or_id"])
self.verify_get(self.proxy.get_vpn_service, vpn_service.VPNService)
def test_vpn_services(self):
self.verify_list(self.proxy.vpn_services, vpn_service.VPNService,

View File

@ -73,8 +73,8 @@ class TestObjectStoreProxy(test_proxy_base.TestProxyBase):
self.verify_create(self.proxy.create_object, obj.Object)
def test_object_get(self):
self.verify_get3(obj.Object, self.proxy.get_object,
value="object", container="container")
self.verify_get(self.proxy.get_object, obj.Object,
value=["object"], container="container")
class Test_containers(TestObjectStoreProxy, base.TestTransportBase):

View File

@ -36,10 +36,7 @@ class TestOrchestrationProxy(test_proxy_base.TestProxyBase):
self.verify_list(self.proxy.stacks, stack.Stack, paginated=False)
def test_stack_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_stack,
method_args=["resource_or_id"],
expected_args=[stack.Stack, "resource_or_id"])
self.verify_get(self.proxy.get_stack, stack.Stack)
def test_stack_delete(self):
self.verify_delete(self.proxy.delete_stack, stack.Stack, False)

View File

@ -52,10 +52,7 @@ class TestTelemetryProxy(test_proxy_base.TestProxyBase):
self.proxy.find_alarm)
def test_alarm_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_alarm,
method_args=["resource_or_id"],
expected_args=[alarm.Alarm, "resource_or_id"])
self.verify_get(self.proxy.get_alarm, alarm.Alarm)
def test_alarms(self):
self.verify_list(self.proxy.alarms, alarm.Alarm, paginated=False)
@ -83,10 +80,7 @@ class TestTelemetryProxy(test_proxy_base.TestProxyBase):
self.proxy.find_resource)
def test_resource_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get',
self.proxy.get_resource,
method_args=["resource_or_id"],
expected_args=[resource.Resource, "resource_or_id"])
self.verify_get(self.proxy.get_resource, resource.Resource)
def test_resources(self):
self.verify_list(self.proxy.resources, resource.Resource,

View File

@ -100,22 +100,14 @@ class TestProxyBase(base.TestCase):
expected_args=[resource_type, "resource_or_id"],
expected_kwargs=expected_kwargs)
def verify_get(self, mock_method, test_method, **kwargs):
self._verify(mock_method, test_method, expected_result="result",
**kwargs)
def verify_get2(self, mock_method, test_method, **kwargs):
self._verify2(mock_method, test_method, expected_result="result",
**kwargs)
def verify_get3(self, resource, method, value=None, **kwargs):
the_value = [value] if value is not None else []
def verify_get(self, test_method, resource_type, value=None, **kwargs):
the_value = value if value is not None else ["value"]
expected_kwargs = {"path_args": kwargs} if kwargs else {}
self._verify2("openstack.proxy.BaseProxy._get",
method,
test_method,
method_args=the_value,
method_kwargs=kwargs,
expected_args=[resource] + the_value,
expected_args=[resource_type] + the_value,
expected_kwargs=expected_kwargs)
def verify_head(self, resource, method, value=None, **kwargs):