From 73f70f1a92a91753a5d8a26b1afed5900e5bb8ba Mon Sep 17 00:00:00 2001 From: miaohb Date: Tue, 18 Oct 2016 17:10:02 +0800 Subject: [PATCH] Add filters "policy_type" and "policy_name" for policy binding list Add "policy_type" and "policy_name" to query map. Add QueryParameters related unit test case. Depends-On: I452173dff86f75d82bfa967ea333ad42be95d488 Closed-Bug: 1634407 Change-Id: I8363dadbb6afe810ceb161c59027eefca966f011 --- openstack/cluster/v1/cluster_policy.py | 3 ++- openstack/tests/unit/cluster/v1/test_cluster_policy.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/openstack/cluster/v1/cluster_policy.py b/openstack/cluster/v1/cluster_policy.py index 13291cf6..bac40d36 100644 --- a/openstack/cluster/v1/cluster_policy.py +++ b/openstack/cluster/v1/cluster_policy.py @@ -24,7 +24,8 @@ class ClusterPolicy(resource.Resource): allow_list = True allow_get = True - _query_mapping = resource.QueryParameters(is_enabled='enabled') + _query_mapping = resource.QueryParameters( + 'policy_name', 'policy_type', is_enabled='enabled') # Properties #: ID of the policy object. diff --git a/openstack/tests/unit/cluster/v1/test_cluster_policy.py b/openstack/tests/unit/cluster/v1/test_cluster_policy.py index 8ec3f113..43adfabf 100644 --- a/openstack/tests/unit/cluster/v1/test_cluster_policy.py +++ b/openstack/tests/unit/cluster/v1/test_cluster_policy.py @@ -41,6 +41,13 @@ class TestClusterPolicy(testtools.TestCase): self.assertTrue(sot.allow_get) self.assertTrue(sot.allow_list) + self.assertDictEqual({"policy_name": "policy_name", + "policy_type": "policy_type", + "is_enabled": "enabled", + "limit": "limit", + "marker": "marker"}, + sot._query_mapping._mapping) + def test_instantiate(self): sot = cluster_policy.ClusterPolicy(**FAKE) self.assertEqual(FAKE['policy_id'], sot.id)