Merge lp:~jml/pkgme-devportal/libdep-srsly into lp:pkgme-devportal

Proposed by Jonathan Lange
Status: Merged
Approved by: James Westby
Approved revision: 142
Merged at revision: 140
Proposed branch: lp:~jml/pkgme-devportal/libdep-srsly
Merge into: lp:pkgme-devportal
Diff against target: 29 lines (+4/-4)
2 files modified
devportalbinary/database.py (+2/-2)
devportalbinary/tests/test_database.py (+2/-2)
To merge this branch: bzr merge lp:~jml/pkgme-devportal/libdep-srsly
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+130986@code.launchpad.net

Commit message

LibdepServiceClient now provides the correct API

Description of the change

OK, so after we added close(), things still don't work.

That's because LibdepServiceClient is almost entirely wrong. This branch
fixes it.

I haven't gone for full-scale interface verification tests -- maybe I should
have. Instead, I've just updated the direct unit tests to test the correct
interface.

I've also done manual testing with the guess-deps utility, changing my
local config to point to the staging libdep-service. That now works.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'devportalbinary/database.py'
2--- devportalbinary/database.py 2012-10-22 22:15:07 +0000
3+++ devportalbinary/database.py 2012-10-23 12:27:40 +0000
4@@ -500,8 +500,8 @@
5 return cls(Client(options.database_base_url))
6
7 def get_dependencies(self, library_name, arch='i386'):
8- return self._client.get_binaries_for_libraries(library_name,
9- [arch])[arch]
10+ deps = self._client.get_binaries_for_libraries([library_name], [arch])
11+ return set(deps[arch].get(library_name, []))
12
13 def close(self):
14 pass
15
16=== modified file 'devportalbinary/tests/test_database.py'
17--- devportalbinary/tests/test_database.py 2012-10-22 22:15:07 +0000
18+++ devportalbinary/tests/test_database.py 2012-10-23 12:27:40 +0000
19@@ -459,8 +459,8 @@
20 client = Client(double.base_url)
21 wrapper = LibdepServiceClient(client)
22 self.assertEqual(
23- {'libfoo': ['libfoo-bin']},
24- wrapper.get_dependencies(['libfoo'], 'i386'))
25+ set(['libfoo-bin']), wrapper.get_dependencies('libfoo', 'i386'))
26+ self.assertEqual(set(), wrapper.get_dependencies('libbar', 'i386'))
27
28 def test_has_close_method(self):
29 client = Client('http://localhost/')

Subscribers

People subscribed via source and target branches