Merge "Correct field filtering for member/l7rule/amphora"

This commit is contained in:
Zuul 2018-05-07 15:51:29 +00:00 committed by Gerrit Code Review
commit f33c461cb9
6 changed files with 16 additions and 15 deletions

View File

@ -51,8 +51,8 @@ class AmphoraController(base.BaseController):
db_amp, amp_types.AmphoraResponse) db_amp, amp_types.AmphoraResponse)
return amp_types.AmphoraRootResponse(amphora=result) return amp_types.AmphoraRootResponse(amphora=result)
@wsme_pecan.wsexpose(amp_types.AmphoraeRootResponse, wtypes.text, @wsme_pecan.wsexpose(amp_types.AmphoraeRootResponse, [wtypes.text],
[wtypes.text], ignore_extra_args=True) ignore_extra_args=True)
def get_all(self, fields=None): def get_all(self, fields=None):
"""Gets all health monitors.""" """Gets all health monitors."""
pcontext = pecan.request.context pcontext = pecan.request.context

View File

@ -55,8 +55,8 @@ class L7RuleController(base.BaseController):
l7rule_types.L7RuleResponse) l7rule_types.L7RuleResponse)
return l7rule_types.L7RuleRootResponse(rule=result) return l7rule_types.L7RuleRootResponse(rule=result)
@wsme_pecan.wsexpose(l7rule_types.L7RulesRootResponse, wtypes.text, @wsme_pecan.wsexpose(l7rule_types.L7RulesRootResponse, [wtypes.text],
[wtypes.text], ignore_extra_args=True) ignore_extra_args=True)
def get_all(self, fields=None): def get_all(self, fields=None):
"""Lists all l7rules of a l7policy.""" """Lists all l7rules of a l7policy."""
pcontext = pecan.request.context pcontext = pecan.request.context

View File

@ -56,8 +56,8 @@ class MemberController(base.BaseController):
member_types.MemberResponse) member_types.MemberResponse)
return member_types.MemberRootResponse(member=result) return member_types.MemberRootResponse(member=result)
@wsme_pecan.wsexpose(member_types.MembersRootResponse, wtypes.text, @wsme_pecan.wsexpose(member_types.MembersRootResponse, [wtypes.text],
[wtypes.text], ignore_extra_args=True) ignore_extra_args=True)
def get_all(self, fields=None): def get_all(self, fields=None):
"""Lists all pool members of a pool.""" """Lists all pool members of a pool."""
pcontext = pecan.request.context pcontext = pecan.request.context

View File

@ -304,11 +304,11 @@ class TestAmphora(base.BaseAPITest):
def test_get_all_fields_filter(self): def test_get_all_fields_filter(self):
amps = self.get(self.AMPHORAE_PATH, params={ amps = self.get(self.AMPHORAE_PATH, params={
'fields': ['id', 'compute_id']}).json 'fields': ['id', 'role']}).json
for amp in amps['amphorae']: for amp in amps['amphorae']:
self.assertIn(u'id', amp.keys()) self.assertIn(u'id', amp.keys())
self.assertIn(u'compute_id', amp.keys()) self.assertIn(u'role', amp.keys())
self.assertNotIn(u'vrrp_ip', amp.keys()) self.assertNotIn(u'ha_port_id', amp.keys())
def test_get_all_filter(self): def test_get_all_filter(self):
self._create_additional_amp() self._create_additional_amp()

View File

@ -305,11 +305,11 @@ class TestL7Rule(base.BaseAPITest):
self.set_lb_status(self.lb_id) self.set_lb_status(self.lb_id)
l7rus = self.get(self.l7rules_path, params={ l7rus = self.get(self.l7rules_path, params={
'fields': ['id', 'project_id']}).json 'fields': ['id', 'compare_type']}).json
for l7ru in l7rus['rules']: for l7ru in l7rus['rules']:
self.assertIn(u'id', l7ru.keys()) self.assertIn(u'id', l7ru.keys())
self.assertIn(u'project_id', l7ru.keys()) self.assertIn(u'compare_type', l7ru.keys())
self.assertNotIn(u'description', l7ru.keys()) self.assertNotIn(u'project_id', l7ru.keys())
def test_get_all_filter(self): def test_get_all_filter(self):
ru1 = self.create_l7rule( ru1 = self.create_l7rule(

View File

@ -296,11 +296,12 @@ class TestMember(base.BaseAPITest):
self.set_lb_status(self.lb_id) self.set_lb_status(self.lb_id)
members = self.get(self.members_path, params={ members = self.get(self.members_path, params={
'fields': ['id', 'project_id']}).json 'fields': ['id', 'address']}).json
for member in members['members']: for member in members['members']:
self.assertIn(u'id', member.keys()) self.assertIn(u'id', member.keys())
self.assertIn(u'project_id', member.keys()) self.assertIn(u'address', member.keys())
self.assertNotIn(u'description', member.keys()) self.assertNotIn(u'name', member.keys())
self.assertNotIn(u'monitor_address', member.keys())
def test_get_all_filter(self): def test_get_all_filter(self):
mem1 = self.create_member(self.pool_id, mem1 = self.create_member(self.pool_id,