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
=== added file 'tests/platform/session/test_common.py'
--- tests/platform/session/test_common.py 1970-01-01 00:00:00 +0000
+++ tests/platform/session/test_common.py 2012-06-26 17:49:28 +0000
@@ -0,0 +1,46 @@
1#
2# Copyright 2011-2012 Canonical Ltd.
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
7#
8# This program is distributed in the hope that it will be useful, but
9# WITHOUT ANY WARRANTY; without even the implied warranties of
10# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11# PURPOSE. See the GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License along
14# with this program. If not, see <http://www.gnu.org/licenses/>.
15#
16# In addition, as a special exception, the copyright holders give
17# permission to link the code of portions of this program with the
18# OpenSSL library under certain conditions as described in each
19# individual source file, and distribute linked combinations
20# including the two.
21# You must obey the GNU General Public License in all respects
22# for all of the code used other than OpenSSL. If you modify
23# file(s) with this exception, you may extend this exception to your
24# version of the file(s), but you are not obligated to do so. If you
25# do not wish to do so, delete this exception statement from your
26# version. If you delete this exception statement from all source
27# files in the program, then also delete it here.
28"""Inhibitor tests for darwin."""
29
30from twisted.internet import defer
31from twisted.trial.unittest import TestCase
32
33from ubuntuone.devtools.testcases import skipIfOS
34from ubuntuone.platform.session import Inhibitor, INHIBIT_LOGOUT_SUSPEND
35
36
37@skipIfOS('linux2', 'Ignored becuase it requires a DBusTestCases.')
38class InhibitorTestCase(TestCase):
39 """Test the inhibitor class."""
40
41 @defer.inlineCallbacks
42 def test_inihibit_returns_self(self):
43 inhibitor = Inhibitor()
44 result = yield inhibitor.inhibit(INHIBIT_LOGOUT_SUSPEND, 'test')
45 self.assertEqual(inhibitor, result)
46
047
=== modified file 'tests/platform/session/test_linux.py'
--- tests/platform/session/test_linux.py 2012-04-27 19:30:11 +0000
+++ tests/platform/session/test_linux.py 2012-06-26 17:49:28 +0000
@@ -126,7 +126,8 @@
126 session.SESSION_MANAGER_BUSNAME,126 session.SESSION_MANAGER_BUSNAME,
127 session.SESSION_MANAGER_PATH,127 session.SESSION_MANAGER_PATH,
128 FakeGnomeSessionManagerInhibitor)128 FakeGnomeSessionManagerInhibitor)
129 yield session.inhibit_logout_suspend("fake reason")129 inhibit_result = yield session.inhibit_logout_suspend("fake reason")
130 self.assertNotEqual(None, inhibit_result)
130 result = fakeinhibitor.IsInhibited(session.INHIBIT_LOGGING_OUT)131 result = fakeinhibitor.IsInhibited(session.INHIBIT_LOGGING_OUT)
131 self.assertTrue(result)132 self.assertTrue(result)
132 result = fakeinhibitor.IsInhibited(session.INHIBIT_SUSPENDING_COMPUTER)133 result = fakeinhibitor.IsInhibited(session.INHIBIT_SUSPENDING_COMPUTER)
133134
=== modified file 'ubuntuone/platform/session/darwin.py'
--- ubuntuone/platform/session/darwin.py 2012-05-16 12:52:13 +0000
+++ ubuntuone/platform/session/darwin.py 2012-06-26 17:49:28 +0000
@@ -36,7 +36,7 @@
3636
37 def inhibit(self, flags, reason):37 def inhibit(self, flags, reason):
38 """Inhibit some events with a given reason."""38 """Inhibit some events with a given reason."""
39 return defer.succeed(None)39 return defer.succeed(self)
4040
41 def cancel(self):41 def cancel(self):
42 """Cancel the inhibition for the current cookie."""42 """Cancel the inhibition for the current cookie."""
4343
=== modified file 'ubuntuone/platform/session/windows.py'
--- ubuntuone/platform/session/windows.py 2012-04-27 19:30:11 +0000
+++ ubuntuone/platform/session/windows.py 2012-06-26 17:49:28 +0000
@@ -36,7 +36,7 @@
3636
37 def inhibit(self, flags, reason):37 def inhibit(self, flags, reason):
38 """Inhibit some events with a given reason."""38 """Inhibit some events with a given reason."""
39 return defer.succeed(None)39 return defer.succeed(self)
4040
41 def cancel(self):41 def cancel(self):
42 """Cancel the inhibition for the current cookie."""42 """Cancel the inhibition for the current cookie."""

Subscribers

People subscribed via source and target branches