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
1=== modified file 'tests/platform/windows/test_os_helper.py'
2--- tests/platform/windows/test_os_helper.py 2012-04-09 20:07:05 +0000
3+++ tests/platform/windows/test_os_helper.py 2012-05-16 22:05:30 +0000
4@@ -32,7 +32,6 @@
5 import os
6 import shutil
7 import sys
8-import platform
9
10 from twisted.internet import defer
11 from twisted.trial.unittest import TestCase
12@@ -482,19 +481,10 @@
13
14
15 class TestIsRoot(TestCase):
16-
17 """Tests for the is_root function."""
18
19- def test_isanadmin_called(self):
20- """Test that shell.IsUserAnAdmin is called."""
21- expected = object()
22- self.patch(os_helper.shell, 'IsUserAnAdmin', lambda: expected)
23- actual = os_helper.is_root()
24- self.assertEqual(expected, actual)
25-
26- def test_is_root_on_xp(self):
27- """Test that os_helper.is_root always returns False on XP"""
28+ def test_is_root(self):
29+ """Test that os_helper.is_root always returns False"""
30 expected = False
31- self.patch(platform, "version", "5.1.2600")
32 actual = os_helper.is_root()
33 self.assertEqual(expected, actual)
34
35=== modified file 'ubuntuone/platform/windows/os_helper.py'
36--- ubuntuone/platform/windows/os_helper.py 2012-04-09 20:07:05 +0000
37+++ ubuntuone/platform/windows/os_helper.py 2012-05-16 22:05:30 +0000
38@@ -35,7 +35,6 @@
39 import stat
40 import sys
41
42-from platform import version
43 from contextlib import contextmanager
44 from functools import wraps
45
46@@ -885,13 +884,11 @@
47
48 def is_root():
49 """Return if the user is running as root."""
50- # On Windows XP (v5.1), always return False. Nearly all users run with
51- # Administrator access, so this would restrict too many users.
52- # On Vista (v6.0) and 7 (v6.1), return the real Administrator value.
53- # The MSDN docs say this may go away in a later version, but look at what
54- # the alternative is: http://bit.ly/rXbIwc
55- is_xp = version()[0] == "5"
56- return False if is_xp else shell.IsUserAnAdmin()
57+ # Always return False. Trying to be smart about OS versions and
58+ # only calling Windows APIs under certain conditions has still
59+ # proven not to work in some cases. Overall it should not matter
60+ # if we know whether we are Administrator or not on Windows.
61+ return False
62
63
64 @windowspath()

Subscribers

People subscribed via source and target branches

to all changes: