Merge lp:~diegosarmentero/ubuntuone-client/fix-dummy into lp:ubuntuone-client

Proposed by Diego Sarmentero
Status: Merged
Approved by: dobey
Approved revision: 1324
Merged at revision: 1320
Proposed branch: lp:~diegosarmentero/ubuntuone-client/fix-dummy
Merge into: lp:ubuntuone-client
Diff against target: 48 lines (+20/-0)
2 files modified
tests/platform/sync_menu/test_linux.py (+16/-0)
ubuntuone/platform/sync_menu/linux.py (+4/-0)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/fix-dummy
Reviewer Review Type Date Requested Status
dobey (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+125696@code.launchpad.net

Commit message

- Fixed dummy init (LP: #1053775).

To post a comment you must log in.
1321. By Diego Sarmentero

fixing test case

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks great! Thanks

review: Approve
Revision history for this message
dobey (dobey) wrote :

Please chain the __init__ with super here properly so that object.__init__() is called, as well as on the UbuntuOneSyncMenuLinux class.

Also, please use assertNotRaises() to test instantiation of the object is working. To test that start_timer works properly, please add a second test to this test case which creates a dummy object, and then check that the start_timer attribute has a "__call__" attribute itself.

review: Needs Fixing
1322. By Diego Sarmentero

docstring updated

1323. By Diego Sarmentero

checking that dummy has start_timer and it is callable

1324. By Diego Sarmentero

using assertIsInstance

Revision history for this message
dobey (dobey) wrote :

Looks ok now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/sync_menu/test_linux.py'
2--- tests/platform/sync_menu/test_linux.py 2012-09-19 17:23:02 +0000
3+++ tests/platform/sync_menu/test_linux.py 2012-09-21 14:11:21 +0000
4@@ -28,6 +28,8 @@
5 # files in the program, then also delete it here.
6 """Test the Sync Menu."""
7
8+from collections import Callable
9+
10 from twisted.internet import defer
11 from twisted.trial.unittest import TestCase
12
13@@ -91,6 +93,20 @@
14 self.data['connect'] = (signal, callback)
15
16
17+class SyncMenuDummyTestCase(TestCase):
18+ """Test the SyncMenu."""
19+
20+ def test_dummy_support(self):
21+ """Check that the Dummy object can be created properly."""
22+ dummy = linux.DummySyncMenu('random', 'args')
23+ self.assertIsInstance(dummy, linux.DummySyncMenu)
24+
25+ def test_dummy_has_start_timer(self):
26+ """Check that the dummy has the proper methods required by the API."""
27+ dummy = linux.DummySyncMenu('random', 'args')
28+ self.assertIsInstance(dummy.start_timer, Callable)
29+
30+
31 class SyncMenuTestCase(TestCase):
32 """Test the SyncMenu."""
33
34
35=== modified file 'ubuntuone/platform/sync_menu/linux.py'
36--- ubuntuone/platform/sync_menu/linux.py 2012-09-19 17:23:02 +0000
37+++ ubuntuone/platform/sync_menu/linux.py 2012-09-21 14:11:21 +0000
38@@ -222,6 +222,10 @@
39
40
41 class DummySyncMenu(object):
42+ """Dummy SyncMenu"""
43+
44+ def __init__(self, *args, **kwargs):
45+ """Initialize menu."""
46
47 def start_timer(self):
48 """Do nothing."""

Subscribers

People subscribed via source and target branches