Merge lp:~dobey/ubuntuone-installer/core-cache into lp:ubuntuone-installer

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 33
Merged at revision: 32
Proposed branch: lp:~dobey/ubuntuone-installer/core-cache
Merge into: lp:ubuntuone-installer
Diff against target: 52 lines (+24/-1)
2 files modified
ubuntuone/installer/gui.py (+2/-1)
ubuntuone/installer/tests/test_gui.py (+22/-0)
To merge this branch: bzr merge lp:~dobey/ubuntuone-installer/core-cache
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve
Eric Casteleijn (community) Approve
Review via email: mp+113286@code.launchpad.net

Commit message

Add a fake aptdaemon and fake transaction object to avoid annoying dbus errors
Pass only the system sources.list as the the list to use for updating the cache

To post a comment you must log in.
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Looks fine to me

review: Approve
Revision history for this message
Mike McCracken (mikemc) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/installer/gui.py'
2--- ubuntuone/installer/gui.py 2012-05-25 19:29:11 +0000
3+++ ubuntuone/installer/gui.py 2012-07-03 19:54:18 +0000
4@@ -406,7 +406,8 @@
5 else:
6 self.__install_u1()
7
8- transaction = yield self.client.update_cache()
9+ transaction = yield self.client.update_cache(
10+ sources_list='/etc/apt/sources.list')
11 transaction.connect('finished', finished)
12 self.__apt_progress.set_transaction(transaction)
13 transaction.run()
14
15=== modified file 'ubuntuone/installer/tests/test_gui.py'
16--- ubuntuone/installer/tests/test_gui.py 2012-05-21 17:56:04 +0000
17+++ ubuntuone/installer/tests/test_gui.py 2012-07-03 19:54:18 +0000
18@@ -21,12 +21,34 @@
19 from ubuntuone.installer import gui
20
21
22+class FakeTransaction(object):
23+ """Fake transaction object."""
24+
25+ def connect(self, *args, **kwargs):
26+ """Fake signal connection."""
27+
28+ def run(self, *args, **kwargs):
29+ """Fake runner."""
30+
31+
32+class FakeAptClient(object):
33+ """Fake client for apt."""
34+
35+ def __init__(self, *args, **kwargs):
36+ super(FakeAptClient, self).__init__(*args, **kwargs)
37+
38+ def update_cache(self, *args, **kwargs):
39+ """Fake update_cache call."""
40+ return FakeTransaction()
41+
42+
43 class GUITestCase(DBusTestCase):
44 """Main class tests."""
45
46 @inlineCallbacks
47 def setUp(self):
48 yield super(GUITestCase, self).setUp()
49+ self.patch(gui.aptclient, 'AptClient', FakeAptClient)
50 gui.Gtk.main_quit = lambda: None
51 gui.Gtk.main = lambda: None
52 self.dlg = gui.Window()

Subscribers

People subscribed via source and target branches

to all changes: