Merge lp:~tvansteenburgh/charmworldlib/bundle-support into lp:charmworldlib

Proposed by Tim Van Steenburgh
Status: Merged
Merged at revision: 33
Proposed branch: lp:~tvansteenburgh/charmworldlib/bundle-support
Merge into: lp:charmworldlib
Diff against target: 34 lines (+3/-3)
2 files modified
charmworldlib/bundle.py (+1/-1)
tests/test_bundles.py (+2/-2)
To merge this branch: bzr merge lp:~tvansteenburgh/charmworldlib/bundle-support
Reviewer Review Type Date Requested Status
Marco Ceppi (community) Approve
Review via email: mp+226883@code.launchpad.net

Description of the change

Fix bundle search result handling.

Each bundle search result is wrapped in a "bundle" dictionary key, whereas direct bundle fetches returned the bundle data at the top-level. This differs from the Charm api, which wraps all results, whether searches or fetches, inside a "charm" dictionary key.

To post a comment you must log in.
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

LGTM, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmworldlib/bundle.py'
2--- charmworldlib/bundle.py 2014-05-15 18:26:05 +0000
3+++ charmworldlib/bundle.py 2014-07-15 16:55:45 +0000
4@@ -58,7 +58,7 @@
5 self._doctype,
6 criteria=criteria,
7 limit=limit)
8- return [Bundle.from_bundledata(bundle) for bundle in result]
9+ return [Bundle.from_bundledata(bundle['bundle']) for bundle in result]
10
11 def approved(self):
12 return self.search(criteria={'type': 'approved'})
13
14=== modified file 'tests/test_bundles.py'
15--- tests/test_bundles.py 2014-05-15 18:26:05 +0000
16+++ tests/test_bundles.py 2014-07-15 16:55:45 +0000
17@@ -32,7 +32,7 @@
18 mget.return_value = {'result': [cdata]}
19 self.assertEqual([mBundle.from_bundledata()], self.b.search())
20 mget.assert_called_with('search', {'text': 'bundle'})
21- mBundle.from_bundledata.assert_called_with(cdata)
22+ mBundle.from_bundledata.assert_called_with(cdata['bundle'])
23
24 @patch('charmworldlib.bundle.Bundles.get')
25 def test_bundles_search_string(self, mget):
26@@ -61,7 +61,7 @@
27 mget.return_value = {'result': [cdata]}
28 self.assertEqual([mBundle.from_bundledata()], self.b.search())
29 mget.assert_called_with('search', {'text': 'bundle'})
30- mBundle.from_bundledata.assert_called_with(cdata)
31+ mBundle.from_bundledata.assert_called_with(cdata['bundle'])
32
33 @patch('charmworldlib.bundle.Bundles.get')
34 def test_bundles_approved(self, mget):

Subscribers

People subscribed via source and target branches

to all changes: