Allow image filtering by custom properties

A user can filter a list of images by passing in a 'properties'
sub-dictionary inside of the 'filters' keyword argumen to
ImageManager.list(). The same functionality can be used through
the CLI through the use of one or more'--property-filter' options.

Related to bp glance-client-parity.

Change-Id: I7d119174d83faa894dde557e1944289de296a02c
This commit is contained in:
Brian Waldon
2012-07-04 15:46:29 -07:00
parent e7db533bc0
commit a1691ddc10
3 changed files with 16 additions and 0 deletions
+5
View File
@@ -118,6 +118,11 @@ class ImageManagerTest(unittest.TestCase):
expect = [('GET', '/v1/images/detail?name=foo', {}, None)]
self.assertEqual(self.api.calls, expect)
def test_list_with_property_filters(self):
self.mgr.list(filters={'properties': {'ping': 'pong'}})
expect = [('GET', '/v1/images/detail?property-ping=pong', {}, None)]
self.assertEqual(self.api.calls, expect)
def test_get(self):
image = self.mgr.get('1')
expect = [('HEAD', '/v1/images/1', {}, None)]