Merge lp:~dobey/ubuntuone-client/fix-984407-3-0 into lp:ubuntuone-client/stable-3-0

Proposed by dobey
Status: Merged
Approved by: Roberto Alsina
Approved revision: 1187
Merged at revision: 1187
Proposed branch: lp:~dobey/ubuntuone-client/fix-984407-3-0
Merge into: lp:ubuntuone-client/stable-3-0
Diff against target: 64 lines (+7/-20)
2 files modified
tests/platform/windows/test_os_helper.py (+2/-12)
ubuntuone/platform/windows/os_helper.py (+5/-8)
To merge this branch: bzr merge lp:~dobey/ubuntuone-client/fix-984407-3-0
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+106063@code.launchpad.net

Commit message

No longer check whether or not we are actually running as admin on Windows

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/platform/windows/test_os_helper.py'
--- tests/platform/windows/test_os_helper.py 2012-04-09 20:07:05 +0000
+++ tests/platform/windows/test_os_helper.py 2012-05-16 22:05:30 +0000
@@ -32,7 +32,6 @@
32import os32import os
33import shutil33import shutil
34import sys34import sys
35import platform
3635
37from twisted.internet import defer36from twisted.internet import defer
38from twisted.trial.unittest import TestCase37from twisted.trial.unittest import TestCase
@@ -482,19 +481,10 @@
482481
483482
484class TestIsRoot(TestCase):483class TestIsRoot(TestCase):
485
486 """Tests for the is_root function."""484 """Tests for the is_root function."""
487485
488 def test_isanadmin_called(self):486 def test_is_root(self):
489 """Test that shell.IsUserAnAdmin is called."""487 """Test that os_helper.is_root always returns False"""
490 expected = object()
491 self.patch(os_helper.shell, 'IsUserAnAdmin', lambda: expected)
492 actual = os_helper.is_root()
493 self.assertEqual(expected, actual)
494
495 def test_is_root_on_xp(self):
496 """Test that os_helper.is_root always returns False on XP"""
497 expected = False488 expected = False
498 self.patch(platform, "version", "5.1.2600")
499 actual = os_helper.is_root()489 actual = os_helper.is_root()
500 self.assertEqual(expected, actual)490 self.assertEqual(expected, actual)
501491
=== modified file 'ubuntuone/platform/windows/os_helper.py'
--- ubuntuone/platform/windows/os_helper.py 2012-04-09 20:07:05 +0000
+++ ubuntuone/platform/windows/os_helper.py 2012-05-16 22:05:30 +0000
@@ -35,7 +35,6 @@
35import stat35import stat
36import sys36import sys
3737
38from platform import version
39from contextlib import contextmanager38from contextlib import contextmanager
40from functools import wraps39from functools import wraps
4140
@@ -885,13 +884,11 @@
885884
886def is_root():885def is_root():
887 """Return if the user is running as root."""886 """Return if the user is running as root."""
888 # On Windows XP (v5.1), always return False. Nearly all users run with887 # Always return False. Trying to be smart about OS versions and
889 # Administrator access, so this would restrict too many users.888 # only calling Windows APIs under certain conditions has still
890 # On Vista (v6.0) and 7 (v6.1), return the real Administrator value.889 # proven not to work in some cases. Overall it should not matter
891 # The MSDN docs say this may go away in a later version, but look at what890 # if we know whether we are Administrator or not on Windows.
892 # the alternative is: http://bit.ly/rXbIwc891 return False
893 is_xp = version()[0] == "5"
894 return False if is_xp else shell.IsUserAnAdmin()
895892
896893
897@windowspath()894@windowspath()

Subscribers

People subscribed via source and target branches

to all changes: