Ensure domains.list filtered results are correct

Convert enabled=False to enabled=0, such that requests directed to
an older keystone not containing the fix for bug #1267530 will not
return the wrong data.

Closes-Bug: #1281070
Change-Id: I49fd0953fc2323f2034c241c6342ced6f3412125
This commit is contained in:
Steven Hardy
2014-02-17 11:39:54 +00:00
parent 1c744bb266
commit e509cc0ddf
2 changed files with 16 additions and 0 deletions

View File

@@ -29,3 +29,15 @@ class DomainTests(utils.TestCase, utils.CrudTests):
kwargs.setdefault('enabled', True)
kwargs.setdefault('name', uuid.uuid4().hex)
return kwargs
def test_list_filter_name(self):
super(DomainTests, self).test_list(name='adomain123')
def test_list_filter_enabled(self):
super(DomainTests, self).test_list(enabled=True)
def test_list_filter_disabled(self):
# False is converted to '0' ref bug #1267530
expected_query = {'enabled': '0'}
super(DomainTests, self).test_list(expected_query=expected_query,
enabled=False)

View File

@@ -50,6 +50,10 @@ class DomainManager(base.CrudManager):
``**kwargs`` allows filter criteria to be passed where
supported by the server.
"""
# Ref bug #1267530 we have to pass 0 for False to get the expected
# results on all keystone versions
if kwargs.get('enabled') is False:
kwargs['enabled'] = 0
return super(DomainManager, self).list(**kwargs)
def update(self, domain, name=None,