Merge "Ensure domains.list filtered results are correct"

This commit is contained in:
Jenkins
2014-02-23 16:25:45 +00:00
committed by Gerrit Code Review
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,