Merge lp:~mandel/ubuntuone-client/darwin-inhibitor into lp:ubuntuone-client

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 1266
Merged at revision: 1265
Proposed branch: lp:~mandel/ubuntuone-client/darwin-inhibitor
Merge into: lp:ubuntuone-client
Diff against target: 90 lines (+50/-3)
4 files modified
tests/platform/session/test_common.py (+46/-0)
tests/platform/session/test_linux.py (+2/-1)
ubuntuone/platform/session/darwin.py (+1/-1)
ubuntuone/platform/session/windows.py (+1/-1)
To merge this branch: bzr merge lp:~mandel/ubuntuone-client/darwin-inhibitor
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+112179@code.launchpad.net

Commit message

- Ensure that the inhibitor does return self in the inhibit method (LP: #1017922)

Description of the change

- Ensure that the inhibitor does return self in the inhibit method (LP: #1017922)

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 code review

review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1 tests

review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

and code review :P

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'tests/platform/session/test_common.py'
2--- tests/platform/session/test_common.py 1970-01-01 00:00:00 +0000
3+++ tests/platform/session/test_common.py 2012-06-26 17:49:28 +0000
4@@ -0,0 +1,46 @@
5+#
6+# Copyright 2011-2012 Canonical Ltd.
7+#
8+# This program is free software: you can redistribute it and/or modify it
9+# under the terms of the GNU General Public License version 3, as published
10+# by the Free Software Foundation.
11+#
12+# This program is distributed in the hope that it will be useful, but
13+# WITHOUT ANY WARRANTY; without even the implied warranties of
14+# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15+# PURPOSE. See the GNU General Public License for more details.
16+#
17+# You should have received a copy of the GNU General Public License along
18+# with this program. If not, see <http://www.gnu.org/licenses/>.
19+#
20+# In addition, as a special exception, the copyright holders give
21+# permission to link the code of portions of this program with the
22+# OpenSSL library under certain conditions as described in each
23+# individual source file, and distribute linked combinations
24+# including the two.
25+# You must obey the GNU General Public License in all respects
26+# for all of the code used other than OpenSSL. If you modify
27+# file(s) with this exception, you may extend this exception to your
28+# version of the file(s), but you are not obligated to do so. If you
29+# do not wish to do so, delete this exception statement from your
30+# version. If you delete this exception statement from all source
31+# files in the program, then also delete it here.
32+"""Inhibitor tests for darwin."""
33+
34+from twisted.internet import defer
35+from twisted.trial.unittest import TestCase
36+
37+from ubuntuone.devtools.testcases import skipIfOS
38+from ubuntuone.platform.session import Inhibitor, INHIBIT_LOGOUT_SUSPEND
39+
40+
41+@skipIfOS('linux2', 'Ignored becuase it requires a DBusTestCases.')
42+class InhibitorTestCase(TestCase):
43+ """Test the inhibitor class."""
44+
45+ @defer.inlineCallbacks
46+ def test_inihibit_returns_self(self):
47+ inhibitor = Inhibitor()
48+ result = yield inhibitor.inhibit(INHIBIT_LOGOUT_SUSPEND, 'test')
49+ self.assertEqual(inhibitor, result)
50+
51
52=== modified file 'tests/platform/session/test_linux.py'
53--- tests/platform/session/test_linux.py 2012-04-27 19:30:11 +0000
54+++ tests/platform/session/test_linux.py 2012-06-26 17:49:28 +0000
55@@ -126,7 +126,8 @@
56 session.SESSION_MANAGER_BUSNAME,
57 session.SESSION_MANAGER_PATH,
58 FakeGnomeSessionManagerInhibitor)
59- yield session.inhibit_logout_suspend("fake reason")
60+ inhibit_result = yield session.inhibit_logout_suspend("fake reason")
61+ self.assertNotEqual(None, inhibit_result)
62 result = fakeinhibitor.IsInhibited(session.INHIBIT_LOGGING_OUT)
63 self.assertTrue(result)
64 result = fakeinhibitor.IsInhibited(session.INHIBIT_SUSPENDING_COMPUTER)
65
66=== modified file 'ubuntuone/platform/session/darwin.py'
67--- ubuntuone/platform/session/darwin.py 2012-05-16 12:52:13 +0000
68+++ ubuntuone/platform/session/darwin.py 2012-06-26 17:49:28 +0000
69@@ -36,7 +36,7 @@
70
71 def inhibit(self, flags, reason):
72 """Inhibit some events with a given reason."""
73- return defer.succeed(None)
74+ return defer.succeed(self)
75
76 def cancel(self):
77 """Cancel the inhibition for the current cookie."""
78
79=== modified file 'ubuntuone/platform/session/windows.py'
80--- ubuntuone/platform/session/windows.py 2012-04-27 19:30:11 +0000
81+++ ubuntuone/platform/session/windows.py 2012-06-26 17:49:28 +0000
82@@ -36,7 +36,7 @@
83
84 def inhibit(self, flags, reason):
85 """Inhibit some events with a given reason."""
86- return defer.succeed(None)
87+ return defer.succeed(self)
88
89 def cancel(self):
90 """Cancel the inhibition for the current cookie."""

Subscribers

People subscribed via source and target branches