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
This commit is contained in:
miaohb 2016-10-18 17:10:02 +08:00
parent c64678868e
commit 73f70f1a92
2 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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)