Merge "Refactor verify_update in proxy tests"

This commit is contained in:
Jenkins
2015-06-09 16:45:52 +00:00
committed by Gerrit Code Review
11 changed files with 63 additions and 304 deletions

View File

@@ -46,10 +46,4 @@ class TestClusteringProxy(test_proxy_base.TestProxyBase):
expected_kwargs={'paginated': True, 'limit': 2}) expected_kwargs={'paginated': True, 'limit': 2})
def test_cluster_update(self): def test_cluster_update(self):
kwargs = {"name": "new-name"} self.verify_update(self.proxy.update_cluster, cluster.Cluster)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_cluster,
method_args=['resource_or_id'],
method_kwargs=kwargs,
expected_args=[cluster.Cluster, "resource_or_id"],
expected_kwargs=kwargs)

View File

@@ -68,13 +68,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
expected_kwargs={"paginated": True, "query": 1}) expected_kwargs={"paginated": True, "query": 1})
def test_flavor_update(self): def test_flavor_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_flavor, flavor.Flavor)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_flavor,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[flavor.Flavor, "resource_or_id"],
expected_kwargs=kwargs)
def test_image_delete(self): def test_image_delete(self):
self.verify_delete2(image.Image, self.proxy.delete_image, False) self.verify_delete2(image.Image, self.proxy.delete_image, False)
@@ -129,13 +123,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
expected_kwargs={"paginated": False}) expected_kwargs={"paginated": False})
def test_keypair_update(self): def test_keypair_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_keypair, keypair.Keypair)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_keypair,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[keypair.Keypair, "resource_or_id"],
expected_kwargs=kwargs)
def test_limits_get(self): def test_limits_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get', self.verify_get2('openstack.proxy.BaseProxy._get',
@@ -172,14 +160,8 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
expected_kwargs={"paginated": False}) expected_kwargs={"paginated": False})
def test_server_interface_update(self): def test_server_interface_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_server_interface,
self.verify_update2('openstack.proxy.BaseProxy._update', server_interface.ServerInterface)
self.proxy.update_server_interface,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[server_interface.ServerInterface,
"resource_or_id"],
expected_kwargs=kwargs)
def test_server_ip_find(self): def test_server_ip_find(self):
self.verify_find('openstack.compute.v2.server_ip.ServerIP.find', self.verify_find('openstack.compute.v2.server_ip.ServerIP.find',
@@ -226,13 +208,7 @@ class TestComputeProxy(test_proxy_base.TestProxyBase):
"changes-since": 1, "image": 2}) "changes-since": 1, "image": 2})
def test_server_update(self): def test_server_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_server, server.Server)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_server,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[server.Server, "resource_or_id"],
expected_kwargs=kwargs)
def test_server_wait_for(self): def test_server_wait_for(self):
value = server.Server(attrs={'id': '1234'}) value = server.Server(attrs={'id': '1234'})

View File

@@ -91,14 +91,7 @@ class TestDatabaseProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_instance_update(self): def test_instance_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_instance, instance.Instance)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_instance,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[instance.Instance,
"resource_or_id"],
expected_kwargs=kwargs)
def test_user_create_attrs(self): def test_user_create_attrs(self):
self.verify_create(self.proxy.create_user, user.User) self.verify_create(self.proxy.create_user, user.User)

View File

@@ -47,13 +47,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_role_update(self): def test_role_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_role, role.Role)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_role,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[role.Role, "resource_or_id"],
expected_kwargs=kwargs)
def test_tenant_create_attrs(self): def test_tenant_create_attrs(self):
self.verify_create(self.proxy.create_tenant, tenant.Tenant) self.verify_create(self.proxy.create_tenant, tenant.Tenant)
@@ -80,13 +74,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_tenant_update(self): def test_tenant_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_tenant, tenant.Tenant)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_tenant,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[tenant.Tenant, "resource_or_id"],
expected_kwargs=kwargs)
def test_user_create_attrs(self): def test_user_create_attrs(self):
self.verify_create(self.proxy.create_user, user.User) self.verify_create(self.proxy.create_user, user.User)
@@ -113,10 +101,4 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_user_update(self): def test_user_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_user, user.User)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_user,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[user.User, "resource_or_id"],
expected_kwargs=kwargs)

View File

@@ -57,14 +57,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_credential_update(self): def test_credential_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_credential, credential.Credential)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_credential,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[credential.Credential,
"resource_or_id"],
expected_kwargs=kwargs)
def test_domain_create_attrs(self): def test_domain_create_attrs(self):
self.verify_create(self.proxy.create_domain, domain.Domain) self.verify_create(self.proxy.create_domain, domain.Domain)
@@ -91,13 +84,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_domain_update(self): def test_domain_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_domain, domain.Domain)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_domain,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[domain.Domain, "resource_or_id"],
expected_kwargs=kwargs)
def test_endpoint_create_attrs(self): def test_endpoint_create_attrs(self):
self.verify_create(self.proxy.create_endpoint, endpoint.Endpoint) self.verify_create(self.proxy.create_endpoint, endpoint.Endpoint)
@@ -126,14 +113,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_endpoint_update(self): def test_endpoint_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_endpoint, endpoint.Endpoint)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_endpoint,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[endpoint.Endpoint,
"resource_or_id"],
expected_kwargs=kwargs)
def test_group_create_attrs(self): def test_group_create_attrs(self):
self.verify_create(self.proxy.create_group, group.Group) self.verify_create(self.proxy.create_group, group.Group)
@@ -160,13 +140,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_group_update(self): def test_group_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_group, group.Group)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_group,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[group.Group, "resource_or_id"],
expected_kwargs=kwargs)
def test_policy_create_attrs(self): def test_policy_create_attrs(self):
self.verify_create(self.proxy.create_policy, policy.Policy) self.verify_create(self.proxy.create_policy, policy.Policy)
@@ -193,13 +167,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_policy_update(self): def test_policy_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_policy, policy.Policy)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_policy,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[policy.Policy, "resource_or_id"],
expected_kwargs=kwargs)
def test_project_create_attrs(self): def test_project_create_attrs(self):
self.verify_create(self.proxy.create_project, project.Project) self.verify_create(self.proxy.create_project, project.Project)
@@ -226,13 +194,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_project_update(self): def test_project_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_project, project.Project)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_project,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[project.Project, "resource_or_id"],
expected_kwargs=kwargs)
def test_service_create_attrs(self): def test_service_create_attrs(self):
self.verify_create(self.proxy.create_service, service.Service) self.verify_create(self.proxy.create_service, service.Service)
@@ -259,13 +221,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_service_update(self): def test_service_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_service, service.Service)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_service,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[service.Service, "resource_or_id"],
expected_kwargs=kwargs)
def test_user_create_attrs(self): def test_user_create_attrs(self):
self.verify_create(self.proxy.create_user, user.User) self.verify_create(self.proxy.create_user, user.User)
@@ -292,13 +248,7 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_user_update(self): def test_user_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_user, user.User)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_user,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[user.User, "resource_or_id"],
expected_kwargs=kwargs)
def test_trust_create_attrs(self): def test_trust_create_attrs(self):
self.verify_create(self.proxy.create_trust, trust.Trust) self.verify_create(self.proxy.create_trust, trust.Trust)
@@ -325,10 +275,4 @@ class TestIdentityProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_trust_update(self): def test_trust_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_trust, trust.Trust)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_trust,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[trust.Trust, "resource_or_id"],
expected_kwargs=kwargs)

View File

@@ -45,10 +45,4 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
expected_kwargs={'paginated': True}) expected_kwargs={'paginated': True})
def test_image_update(self): def test_image_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_image, image.Image)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_image,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[image.Image, "resource_or_id"],
expected_kwargs=kwargs)

View File

@@ -32,13 +32,7 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
self.verify_delete2(image.Image, self.proxy.delete_image, True) self.verify_delete2(image.Image, self.proxy.delete_image, True)
def test_image_update(self): def test_image_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_image, image.Image)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_image,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[image.Image, "resource_or_id"],
expected_kwargs=kwargs)
def test_image_get(self): def test_image_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get', self.verify_get2('openstack.proxy.BaseProxy._get',
@@ -61,13 +55,7 @@ class TestImageProxy(test_proxy_base.TestProxyBase):
self.verify_delete2(member.Member, self.proxy.delete_member, True) self.verify_delete2(member.Member, self.proxy.delete_member, True)
def test_member_update(self): def test_member_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_member, member.Member)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_member,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[member.Member, "resource_or_id"],
expected_kwargs=kwargs)
def test_member_get(self): def test_member_get(self):
self.verify_get2('openstack.proxy.BaseProxy._get', self.verify_get2('openstack.proxy.BaseProxy._get',

View File

@@ -49,14 +49,7 @@ class TestKeystoreProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_container_update(self): def test_container_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_container, container.Container)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_container,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[container.Container,
"resource_or_id"],
expected_kwargs=kwargs)
def test_order_create_attrs(self): def test_order_create_attrs(self):
self.verify_create(self.proxy.create_order, order.Order) self.verify_create(self.proxy.create_order, order.Order)
@@ -83,13 +76,7 @@ class TestKeystoreProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_order_update(self): def test_order_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_order, order.Order)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_order,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[order.Order, "resource_or_id"],
expected_kwargs=kwargs)
def test_secret_create_attrs(self): def test_secret_create_attrs(self):
self.verify_create(self.proxy.create_secret, secret.Secret) self.verify_create(self.proxy.create_secret, secret.Secret)
@@ -116,10 +103,4 @@ class TestKeystoreProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_secret_update(self): def test_secret_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_secret, secret.Secret)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_secret,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[secret.Secret, "resource_or_id"],
expected_kwargs=kwargs)

View File

@@ -75,14 +75,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_floating_ip_update(self): def test_floating_ip_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_ip, floating_ip.FloatingIP)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_ip,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[floating_ip.FloatingIP,
"resource_or_id"],
expected_kwargs=kwargs)
def test_health_monitor_create_attrs(self): def test_health_monitor_create_attrs(self):
self.verify_create(self.proxy.create_health_monitor, self.verify_create(self.proxy.create_health_monitor,
@@ -114,14 +107,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_health_monitor_update(self): def test_health_monitor_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_health_monitor,
self.verify_update2('openstack.proxy.BaseProxy._update', health_monitor.HealthMonitor)
self.proxy.update_health_monitor,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[health_monitor.HealthMonitor,
"resource_or_id"],
expected_kwargs=kwargs)
def test_listener_create_attrs(self): def test_listener_create_attrs(self):
self.verify_create(self.proxy.create_listener, listener.Listener) self.verify_create(self.proxy.create_listener, listener.Listener)
@@ -150,14 +137,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_listener_update(self): def test_listener_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_listener, listener.Listener)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_listener,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[listener.Listener,
"resource_or_id"],
expected_kwargs=kwargs)
def test_load_balancer_create_attrs(self): def test_load_balancer_create_attrs(self):
self.verify_create(self.proxy.create_load_balancer, self.verify_create(self.proxy.create_load_balancer,
@@ -189,14 +169,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_load_balancer_update(self): def test_load_balancer_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_load_balancer,
self.verify_update2('openstack.proxy.BaseProxy._update', load_balancer.LoadBalancer)
self.proxy.update_load_balancer,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[load_balancer.LoadBalancer,
"resource_or_id"],
expected_kwargs=kwargs)
def test_metering_label_create_attrs(self): def test_metering_label_create_attrs(self):
self.verify_create(self.proxy.create_metering_label, self.verify_create(self.proxy.create_metering_label,
@@ -228,14 +202,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_metering_label_update(self): def test_metering_label_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_metering_label,
self.verify_update2('openstack.proxy.BaseProxy._update', metering_label.MeteringLabel)
self.proxy.update_metering_label,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[metering_label.MeteringLabel,
"resource_or_id"],
expected_kwargs=kwargs)
def test_metering_label_rule_create_attrs(self): def test_metering_label_rule_create_attrs(self):
self.verify_create(self.proxy.create_metering_label_rule, self.verify_create(self.proxy.create_metering_label_rule,
@@ -268,16 +236,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_metering_label_rule_update(self): def test_metering_label_rule_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_metering_label_rule,
self.verify_update2('openstack.proxy.BaseProxy._update', metering_label_rule.MeteringLabelRule)
self.proxy.update_metering_label_rule,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[
metering_label_rule.MeteringLabelRule,
"resource_or_id"
],
expected_kwargs=kwargs)
def test_network_create_attrs(self): def test_network_create_attrs(self):
self.verify_create(self.proxy.create_network, network.Network) self.verify_create(self.proxy.create_network, network.Network)
@@ -304,13 +264,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_network_update(self): def test_network_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_network, network.Network)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_network,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[network.Network, "resource_or_id"],
expected_kwargs=kwargs)
def test_pool_member_create_attrs(self): def test_pool_member_create_attrs(self):
self.verify_create(self.proxy.create_pool_member, self.verify_create(self.proxy.create_pool_member,
@@ -341,14 +295,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_pool_member_update(self): def test_pool_member_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_pool_member,
self.verify_update2('openstack.proxy.BaseProxy._update', pool_member.PoolMember)
self.proxy.update_pool_member,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[pool_member.PoolMember,
"resource_or_id"],
expected_kwargs=kwargs)
def test_pool_create_attrs(self): def test_pool_create_attrs(self):
self.verify_create(self.proxy.create_pool, pool.Pool) self.verify_create(self.proxy.create_pool, pool.Pool)
@@ -375,13 +323,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_pool_update(self): def test_pool_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_pool, pool.Pool)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_pool,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[pool.Pool, "resource_or_id"],
expected_kwargs=kwargs)
def test_port_create_attrs(self): def test_port_create_attrs(self):
self.verify_create(self.proxy.create_port, port.Port) self.verify_create(self.proxy.create_port, port.Port)
@@ -408,13 +350,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_port_update(self): def test_port_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_port, port.Port)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_port,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[port.Port, "resource_or_id"],
expected_kwargs=kwargs)
def test_quotas(self): def test_quotas(self):
self.verify_list2(self.proxy.quotas, self.verify_list2(self.proxy.quotas,
@@ -446,13 +382,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_router_update(self): def test_router_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_router, router.Router)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_router,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[router.Router, "resource_or_id"],
expected_kwargs=kwargs)
def test_security_group_create_attrs(self): def test_security_group_create_attrs(self):
self.verify_create(self.proxy.create_security_group, self.verify_create(self.proxy.create_security_group,
@@ -484,14 +414,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_security_group_update(self): def test_security_group_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_security_group,
self.verify_update2('openstack.proxy.BaseProxy._update', security_group.SecurityGroup)
self.proxy.update_security_group,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[security_group.SecurityGroup,
"resource_or_id"],
expected_kwargs=kwargs)
def test_security_group_open_port(self): def test_security_group_open_port(self):
mock_class = 'openstack.network.v2._proxy.Proxy' mock_class = 'openstack.network.v2._proxy.Proxy'
@@ -565,16 +489,8 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_security_group_rule_update(self): def test_security_group_rule_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_security_group_rule,
self.verify_update2('openstack.proxy.BaseProxy._update', security_group_rule.SecurityGroupRule)
self.proxy.update_security_group_rule,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[
security_group_rule.SecurityGroupRule,
"resource_or_id"
],
expected_kwargs=kwargs)
def test_subnet_create_attrs(self): def test_subnet_create_attrs(self):
self.verify_create(self.proxy.create_subnet, subnet.Subnet) self.verify_create(self.proxy.create_subnet, subnet.Subnet)
@@ -601,13 +517,7 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_subnet_update(self): def test_subnet_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_subnet, subnet.Subnet)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_subnet,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[subnet.Subnet, "resource_or_id"],
expected_kwargs=kwargs)
def test_vpn_service_create_attrs(self): def test_vpn_service_create_attrs(self):
self.verify_create(self.proxy.create_vpn_service, self.verify_create(self.proxy.create_vpn_service,
@@ -638,11 +548,5 @@ class TestNetworkProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_vpn_service_update(self): def test_vpn_service_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_vpn_service,
self.verify_update2('openstack.proxy.BaseProxy._update', vpn_service.VPNService)
self.proxy.update_vpn_service,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[vpn_service.VPNService,
"resource_or_id"],
expected_kwargs=kwargs)

View File

@@ -61,13 +61,7 @@ class TestTelemetryProxy(test_proxy_base.TestProxyBase):
expected_kwargs={}) expected_kwargs={})
def test_alarm_update(self): def test_alarm_update(self):
kwargs = {"x": 1, "y": 2, "z": 3} self.verify_update(self.proxy.update_alarm, alarm.Alarm)
self.verify_update2('openstack.proxy.BaseProxy._update',
self.proxy.update_alarm,
method_args=["resource_or_id"],
method_kwargs=kwargs,
expected_args=[alarm.Alarm, "resource_or_id"],
expected_kwargs=kwargs)
def test_capability_find(self): def test_capability_find(self):
self.verify_find('openstack.telemetry.v2.capability.Capability.find', self.verify_find('openstack.telemetry.v2.capability.Capability.find',

View File

@@ -152,12 +152,21 @@ class TestProxyBase(base.TestCase):
method, expected_result=["result"], method, expected_result=["result"],
**kwargs) **kwargs)
def verify_update(self, mock_method, test_method, **kwargs): def verify_update(self, test_method, resource_type,
self._verify(mock_method, test_method, expected_result="result", mock_method="openstack.proxy.BaseProxy._update",
**kwargs) expected_result="result", **kwargs):
the_kwargs = {"x": 1, "y": 2, "z": 3}
method_args = ["resource_or_id"]
method_kwargs = the_kwargs
expected_args = [resource_type, "resource_or_id"]
expected_kwargs = the_kwargs
def verify_update2(self, mock_method, test_method, **kwargs): self._verify2(mock_method, test_method,
self._verify2(mock_method, test_method, expected_result="result", expected_result=expected_result,
method_args=method_args,
method_kwargs=method_kwargs,
expected_args=expected_args,
expected_kwargs=expected_kwargs,
**kwargs) **kwargs)
def verify_wait_for_status(self, mock_method, test_method, **kwargs): def verify_wait_for_status(self, mock_method, test_method, **kwargs):