Skip to content

Commit

Permalink
tests: Rename '_verify2' to '_verify' (#218)
Browse files Browse the repository at this point in the history
tests: Rename '_verify2' to '_verify'

According: openstack/openstacksdk@2e7b48f

Reviewed-by: Rodion Gyrbu <[email protected]>
Reviewed-by: None <None>
Reviewed-by: Polina Gubina <None>
  • Loading branch information
anton-sidelnikov authored Jul 26, 2021
1 parent a73ef45 commit 16eba70
Show file tree
Hide file tree
Showing 20 changed files with 209 additions and 156 deletions.
2 changes: 1 addition & 1 deletion otcextensions/tests/unit/sdk/anti_ddos/v1/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_float_ip_stat_day(self):
)

def test_float_ip_stat_week(self):
self._verify2(
self._verify(
'openstack.proxy.Proxy._get',
self.proxy.floating_ip_stat_week,
method_args=None,
Expand Down
42 changes: 22 additions & 20 deletions otcextensions/tests/unit/sdk/auto_scaling/v1/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_get(self):
)

def test_find(self):
self._verify2(
self._verify(
'openstack.proxy.Proxy._find',
self.proxy.find_group,
method_args=["flavor"],
Expand All @@ -71,7 +71,7 @@ def test_create(self):
)

def test_delete(self):
self._verify2(
self._verify(
mock_method='otcextensions.sdk.auto_scaling.v1.group.Group.delete',
test_method=self.proxy.delete_group,
method_args=['group'],
Expand All @@ -82,7 +82,7 @@ def test_delete(self):
)

def test_delete_with_force_delete(self):
self._verify2(
self._verify(
mock_method='otcextensions.sdk.auto_scaling.v1.group.Group.delete',
test_method=self.proxy.delete_group,
method_args=['group'],
Expand All @@ -94,7 +94,7 @@ def test_delete_with_force_delete(self):
)

def test_update(self):
self._verify2(
self._verify(
'openstack.proxy.Proxy._update',
self.proxy.update_group,
method_args=['INSTANCE'],
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_get(self):
)

def test_find(self):
self._verify2(
self._verify(
'openstack.proxy.Proxy._find',
self.proxy.find_config,
method_args=["flavor"],
Expand Down Expand Up @@ -196,7 +196,7 @@ def test_create(self):
)

def test_find(self):
self._verify2(
self._verify(
'openstack.proxy.Proxy._find',
self.proxy.find_policy,
method_args=['pol', 'group'],
Expand All @@ -209,7 +209,7 @@ def test_find(self):
)

def test_update(self):
self._verify2(
self._verify(
'openstack.proxy.Proxy._update',
self.proxy.update_policy,
method_args=['INSTANCE'],
Expand All @@ -222,23 +222,23 @@ def test_update(self):
)

def test_execute(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.policy.Policy._action',
self.proxy.execute_policy,
method_args=['INSTANCE'],
expected_args=[self.proxy, {'action': 'execute'}]
)

def test_resume(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.policy.Policy._action',
self.proxy.resume_policy,
method_args=['INSTANCE'],
expected_args=[self.proxy, {'action': 'resume'}]
)

def test_pause(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.policy.Policy._action',
self.proxy.pause_policy,
method_args=['INSTANCE'],
Expand Down Expand Up @@ -279,7 +279,8 @@ def test_list_scaling(self):
expected_kwargs={
'paginated': False,
'scaling_group_id': 'INSTANCE'
}
},
expected_args=[]
)


Expand All @@ -289,47 +290,48 @@ def test_list(self):
self.verify_list(
self.proxy.instances, _instance.Instance,
method_args=['group'],
base_path='/scaling_group_instance/group/list'
base_path='/scaling_group_instance/group/list',
expected_args=[]
)

def test_batch_action_remove(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.instance.Instance.batch_action',
self.proxy.batch_instance_action,
method_args=['INSTANCE', ['a1', 'a2'], 'REMOVE'],
expected_args=[self.proxy, ['a1', 'a2'], 'REMOVE', False]
)

def test_batch_action_add(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.instance.Instance.batch_action',
self.proxy.batch_instance_action,
method_args=['INSTANCE', ['a1', 'a2'], 'ADD'],
expected_args=[self.proxy, ['a1', 'a2'], 'ADD', False]
)

def test_batch_action_protect(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.instance.Instance.batch_action',
self.proxy.batch_instance_action,
method_args=['INSTANCE', ['a1', 'a2'], 'PROTECT'],
expected_args=[self.proxy, ['a1', 'a2'], 'PROTECT', False]
)

def test_batch_action_unprotect(self):
self._verify2(
self._verify(
'otcextensions.sdk.auto_scaling.v1.instance.Instance.batch_action',
self.proxy.batch_instance_action,
method_args=['INSTANCE', ['a1', 'a2'], 'UNPROTECT'],
expected_args=[self.proxy, ['a1', 'a2'], 'UNPROTECT', False]
)

def test_delete(self):
self.verify_delete(
self.proxy.remove_instance,
_instance.Instance, True,
self._verify(
test_method=self.proxy.remove_instance,
mock_method='otcextensions.sdk.auto_scaling.v1.'
'instance.Instance.remove',
method_args=['instance'],
expected_args=[self.proxy],
expected_kwargs={
'delete_instance': False
Expand All @@ -340,7 +342,7 @@ def test_find(self):
self.verify_find(
test_method=self.proxy.find_instance,
resource_type=_instance.Instance,
value=['name_or_id', 'group'],
method_kwargs={'group': 'group'},
expected_kwargs={
'group_id': 'group'
}
Expand Down
21 changes: 11 additions & 10 deletions otcextensions/tests/unit/sdk/cbr/v3/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_backup_get(self):
def test_member_add(self):
members = ['member1', 'member2']
backup = _backup.Backup(id='backup')
self._verify2(
self._verify(
'otcextensions.sdk.cbr.v3.backup.Backup.add_members',
self.proxy.add_members,
method_args=[backup, members],
Expand Down Expand Up @@ -94,7 +94,7 @@ class TestCBRRestore(TestCBRProxy):
def test_restore_server(self):
attrs = {'a': 'b'}
backup = _backup.Backup(id='my_backup')
self._verify2(
self._verify(
'openstack.proxy.Proxy._create',
self.proxy.restore_data,
method_args=[backup],
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_vault_delete(self):
def test_bind_policy(self):
vault = _vault.Vault(id='vault')
policy = _policy.Policy(id='policy')
self._verify2(
self._verify(
'otcextensions.sdk.cbr.v3.vault.Vault.bind_policy',
self.proxy.bind_policy,
method_args=[vault, policy],
Expand All @@ -142,7 +142,7 @@ def test_bind_policy(self):
def test_unbind_policy(self):
vault = _vault.Vault(id='vault')
policy = _policy.Policy(id='policy')
self._verify2(
self._verify(
'otcextensions.sdk.cbr.v3.vault.Vault.unbind_policy',
self.proxy.unbind_policy,
method_args=[vault, policy],
Expand All @@ -153,7 +153,7 @@ def test_unbind_policy(self):
def test_associate_resources(self):
vault = _vault.Vault(id='vault')
resources = 'resources'
self._verify2(
self._verify(
'otcextensions.sdk.cbr.v3.vault.Vault.associate_resources',
self.proxy.associate_resources,
method_args=[vault, resources],
Expand All @@ -163,7 +163,7 @@ def test_associate_resources(self):
def test_dissociate_resources(self):
vault = _vault.Vault(id='vault')
resources = 'resources'
self._verify2(
self._verify(
'otcextensions.sdk.cbr.v3.vault.Vault.dissociate_resources',
self.proxy.dissociate_resources,
method_args=[vault, resources],
Expand All @@ -179,13 +179,14 @@ def test_list(self):
self.proxy.members,
_member.Member,
method_args=[backup],
expected_kwargs={'backup_id': backup.id}
expected_kwargs={'backup_id': backup.id},
expected_args=[]
)

def test_get(self):
backup = _backup.Backup(id='backup')
member = _member.Member(id='member')
self._verify2(
self._verify(
'openstack.proxy.Proxy._get',
self.proxy.get_member,
method_args=[backup, member],
Expand All @@ -197,7 +198,7 @@ def test_get(self):
def test_delete(self):
backup = _backup.Backup(id='backup')
member = _member.Member(id='member')
self._verify2(
self._verify(
'openstack.proxy.Proxy._delete',
self.proxy.delete_member,
method_args=[backup, member, True],
Expand All @@ -213,7 +214,7 @@ def test_update(self):
member = _member.Member(id='member')
status = 'accepted'
vault = _vault.Vault(id='vault')
self._verify2(
self._verify(
'openstack.proxy.Proxy._update',
self.proxy.update_member,
method_args=[backup, member, status, vault],
Expand Down
9 changes: 5 additions & 4 deletions otcextensions/tests/unit/sdk/cce/v1/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ def test_list(self):
expected_kwargs={
'paginated': False,
'cluster_uuid': 'cluster_id'
}
},
expected_args=[]
)

def test_get(self):
with patch.object(self.proxy, '_find',
return_value=_cluster.Cluster(id='cluster_id')):
self._verify2(
self._verify(
'otcextensions.sdk.sdk_proxy.Proxy._get',
self.proxy.get_cluster_node,
method_args=['cluster_id', 'node'],
Expand All @@ -109,7 +110,7 @@ def test_add_node(self):
attrs = {'a': 'b'}
with patch.object(self.proxy, '_find',
return_value=_cluster.Cluster(id='cluster_id')):
self._verify2(
self._verify(
'otcextensions.sdk.cce.v1.cluster_node.ClusterNode.create',
self.proxy.add_node,
method_args=['cluster_id'],
Expand All @@ -126,7 +127,7 @@ def test_add_node(self):
def test_delete_nodes(self):
with patch.object(self.proxy, '_find',
return_value=_cluster.Cluster(id='cluster_id')):
self._verify2(
self._verify(
'otcextensions.sdk.cce.v1.cluster.Cluster.delete_nodes',
self.proxy.delete_cluster_nodes,
method_args=['cluster_id', ['n1', 'n2']],
Expand Down
Loading

0 comments on commit 16eba70

Please sign in to comment.