Merge lp:~ttx/glance/d2-lp803055 into lp:~hudson-openstack/glance/milestone-proposed

Proposed by Thierry Carrez
Status: Merged
Approved by: Jay Pipes
Approved revision: 141
Merged at revision: 141
Proposed branch: lp:~ttx/glance/d2-lp803055
Merge into: lp:~hudson-openstack/glance/milestone-proposed
Diff against target: 54 lines (+33/-0)
2 files modified
glance/common/client.py (+6/-0)
tests/unit/test_clients.py (+27/-0)
To merge this branch: bzr merge lp:~ttx/glance/d2-lp803055
Reviewer Review Type Date Requested Status
Brian Waldon (community) Approve
Review via email: mp+66202@code.launchpad.net

Commit message

Backport for bug 803055

Description of the change

Backport for bug 803055, which was unfortunately pushed to trunk first.

To post a comment you must log in.
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Sorry, I wasn't sure how to handle the merge prop for it. This looks good, Thierry.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'glance/common/client.py'
2--- glance/common/client.py 2011-06-26 20:45:46 +0000
3+++ glance/common/client.py 2011-06-28 19:53:23 +0000
4@@ -88,6 +88,12 @@
5 body in memory.
6 """
7 if type(params) is dict:
8+
9+ # remove any params that are None
10+ for (key, value) in params.items():
11+ if value is None:
12+ del params[key]
13+
14 action += '?' + urllib.urlencode(params)
15
16 try:
17
18=== modified file 'tests/unit/test_clients.py'
19--- tests/unit/test_clients.py 2011-06-28 13:41:50 +0000
20+++ tests/unit/test_clients.py 2011-06-28 19:53:23 +0000
21@@ -449,6 +449,33 @@
22
23 self.assertEquals(images[0]['id'], 2)
24
25+ def test_get_image_index_limit_None(self):
26+ """Test correct set of images returned with limit param == None."""
27+ extra_fixture = {'id': 3,
28+ 'status': 'saving',
29+ 'is_public': True,
30+ 'disk_format': 'vhd',
31+ 'container_format': 'ovf',
32+ 'name': 'new name! #123',
33+ 'size': 19,
34+ 'checksum': None}
35+
36+ glance.registry.db.api.image_create(None, extra_fixture)
37+
38+ extra_fixture = {'id': 4,
39+ 'status': 'saving',
40+ 'is_public': True,
41+ 'disk_format': 'vhd',
42+ 'container_format': 'ovf',
43+ 'name': 'new name! #125',
44+ 'size': 19,
45+ 'checksum': None}
46+
47+ glance.registry.db.api.image_create(None, extra_fixture)
48+
49+ images = self.client.get_images(limit=None)
50+ self.assertEquals(len(images), 3)
51+
52 def test_get_image_index_by_name(self):
53 """Test correct set of public, name-filtered image returned. This
54 is just a sanity check, we test the details call more in-depth."""

Subscribers

People subscribed via source and target branches