Merge lp:~nataliabidart/ubuntuone-windows-installer/start-right into lp:ubuntuone-windows-installer

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 69
Merged at revision: 68
Proposed branch: lp:~nataliabidart/ubuntuone-windows-installer/start-right
Merge into: lp:ubuntuone-windows-installer
Diff against target: 231 lines (+66/-48)
5 files modified
ubuntuone_installer/gui/qt/tests/test_gui.py (+7/-37)
ubuntuone_installer/gui/qt/utils/linux.py (+1/-1)
ubuntuone_installer/gui/qt/utils/tests/test_linux.py (+15/-0)
ubuntuone_installer/gui/qt/utils/tests/test_windows.py (+40/-6)
ubuntuone_installer/gui/qt/utils/windows.py (+3/-4)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-windows-installer/start-right
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+75618@code.launchpad.net

Commit message

- Start the control panel using the --with-icon switch (LP: #851221).

To post a comment you must log in.
69. By Natalia Bidart

Removing commented out lines.

Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-15 19:10:23 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-15 19:59:23 +0000
@@ -19,14 +19,9 @@
1919
20"""Tests for the Qt UI."""20"""Tests for the Qt UI."""
2121
22import os
23import subprocess
24import sys
25
26from PyQt4 import QtGui, QtCore22from PyQt4 import QtGui, QtCore
27from ubuntuone.devtools.testcase import skipIfOS23from ubuntuone.controlpanel.gui import qt
28from ubuntuone.platform.credentials import APP_NAME24from ubuntuone.platform.credentials import APP_NAME
29from ubuntuone.controlpanel.gui import qt
3025
31from ubuntuone_installer.gui import NEXT26from ubuntuone_installer.gui import NEXT
32from ubuntuone_installer.gui.qt import gui, forgotten, utils27from ubuntuone_installer.gui.qt import gui, forgotten, utils
@@ -485,38 +480,15 @@
485 """Check if the main properties of the windows are set."""480 """Check if the main properties of the windows are set."""
486 self.assertEqual(self.ui.windowTitle(), APP_NAME)481 self.assertEqual(self.ui.windowTitle(), APP_NAME)
487482
488 def test_start_control_panel_on_finishing(self):483 def test_start_control_panel(self):
489 """Calling done with result=1, the control panel should be called."""484 """The control panel starter is called."""
490 gui.AreYouSure.result = 1485 self.patch(utils, 'start_control_panel', self._set_called)
491 self.patch(subprocess, "Popen", self._set_called)486 self.ui.done(result=1)
492 self.ui.done(result=1)487 self.assertEqual(self._called, ((), {}))
493 self.assertEqual(self._called,
494 ((['ubuntuone-control-panel-qt'],), {}))
495
496 @skipIfOS('linux2', 'Windows-specific tests.')
497 def test_start_control_panel_frozen(self):
498 """When frozen, the control-panel has a path."""
499 self.ui.restart()
500 self.ui.show()
501 self.addCleanup(self.ui.hide)
502 gui.AreYouSure.result = 1
503 # I can't patch sys because frozen is not there by default
504 sys.frozen = True
505
506 def clean_frozen():
507 """Remove sys.frozen."""
508 del sys.frozen
509
510 self.addCleanup(clean_frozen)
511 self.patch(subprocess, "Popen", self._set_called)
512 self.ui.done(result=1)
513 self.assertIn(os.sep, self._called[0][0][0])
514 self.assertIn('ubuntuone-control-panel-qt', self._called[0][0][0])
515488
516 def test_not_start_control_panel_on_cancel(self):489 def test_not_start_control_panel_on_cancel(self):
517 """Called done with result=0, control panel should NOT be called."""490 """Called done with result=0, control panel should NOT be called."""
518 gui.AreYouSure.result = 1491 self.patch(utils, 'start_control_panel', self._set_called)
519 self.patch(subprocess, "Popen", self._set_called)
520 self.ui.done(result=0)492 self.ui.done(result=0)
521 self.assertEqual(self._called, False)493 self.assertEqual(self._called, False)
522494
@@ -526,7 +498,6 @@
526 self.patch(self.ui, 'currentId', lambda: self.ui.SIGNIN_PAGE)498 self.patch(self.ui, 'currentId', lambda: self.ui.SIGNIN_PAGE)
527 # Make AreYouSure say the user is "not sure"499 # Make AreYouSure say the user is "not sure"
528 gui.AreYouSure.result = 0500 gui.AreYouSure.result = 0
529 self.patch(subprocess, "Popen", self._set_called)
530 self.ui.show()501 self.ui.show()
531 self.addCleanup(self.ui.hide)502 self.addCleanup(self.ui.hide)
532 self.ui.done(result=0)503 self.ui.done(result=0)
@@ -537,7 +508,6 @@
537 self.ui.show()508 self.ui.show()
538 self.addCleanup(self.ui.hide)509 self.addCleanup(self.ui.hide)
539 self.patch(self.ui, 'currentId', lambda: self.ui.CONGRATULATIONS_PAGE)510 self.patch(self.ui, 'currentId', lambda: self.ui.CONGRATULATIONS_PAGE)
540 self.patch(subprocess, "Popen", self._set_called)
541 self.ui.done(result=0)511 self.ui.done(result=0)
542 self.assertEqual(self._called, False)512 self.assertEqual(self._called, False)
543 self.assertEqual(FakeAreYouSure.shown, False)513 self.assertEqual(FakeAreYouSure.shown, False)
544514
=== modified file 'ubuntuone_installer/gui/qt/utils/linux.py'
--- ubuntuone_installer/gui/qt/utils/linux.py 2011-09-07 20:34:19 +0000
+++ ubuntuone_installer/gui/qt/utils/linux.py 2011-09-15 19:59:23 +0000
@@ -29,7 +29,7 @@
2929
30def start_control_panel():30def start_control_panel():
31 """Start the control panel."""31 """Start the control panel."""
32 subprocess.Popen(["ubuntuone-control-panel-qt", ])32 subprocess.Popen(["ubuntuone-control-panel-qt"])
3333
3434
35def remove_syncdaemon_from_autostart():35def remove_syncdaemon_from_autostart():
3636
=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_linux.py'
--- ubuntuone_installer/gui/qt/utils/tests/test_linux.py 2011-08-30 14:11:48 +0000
+++ ubuntuone_installer/gui/qt/utils/tests/test_linux.py 2011-09-15 19:59:23 +0000
@@ -19,11 +19,26 @@
19"""Tests for the platform specific functions."""19"""Tests for the platform specific functions."""
2020
21import os21import os
22import subprocess
2223
23from ubuntuone_installer.gui.qt import utils24from ubuntuone_installer.gui.qt import utils
24from ubuntuone_installer.gui.qt.tests import BaseTestCase25from ubuntuone_installer.gui.qt.tests import BaseTestCase
2526
2627
28class StartControlPanelTestCase(BaseTestCase):
29
30 """Test the start of the control panel."""
31
32 def test_start_control_panel(self):
33 """The proper process is started."""
34 self.patch(subprocess, "Popen", self._set_called)
35
36 utils.start_control_panel()
37
38 expected = ((['ubuntuone-control-panel-qt'],), {})
39 self.assertEqual(self._called, expected)
40
41
27class DefaultFoldersTestCase(BaseTestCase):42class DefaultFoldersTestCase(BaseTestCase):
2843
29 """Test the default suggested UDFs."""44 """Test the default suggested UDFs."""
3045
=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py'
--- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-13 14:43:39 +0000
+++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-15 19:59:23 +0000
@@ -20,6 +20,7 @@
2020
21import sys21import sys
22import os22import os
23import subprocess
2324
24# Avoid pylint error on Linux25# Avoid pylint error on Linux
25# pylint: disable=F040126# pylint: disable=F0401
@@ -31,6 +32,7 @@
3132
3233
33class UninstallerTestCase(BaseTestCase):34class UninstallerTestCase(BaseTestCase):
35
34 """Test the uninstaller."""36 """Test the uninstaller."""
3537
36 def test_execute_uninstall_on_licence_cancel_file_not_exists(self):38 def test_execute_uninstall_on_licence_cancel_file_not_exists(self):
@@ -86,8 +88,44 @@
86 self.assertEqual(0, self._called[0][5])88 self.assertEqual(0, self._called[0][5])
8789
8890
91class StartControlPanelTestCase(BaseTestCase):
92
93 """Test the start of the control panel."""
94
95 def test_start_control_panel(self):
96 """The proper process is started."""
97 self.patch(subprocess, "Popen", self._set_called)
98
99 utils.start_control_panel()
100
101 expected = ((['ubuntuone-control-panel-qt', '--with-icon'],), {})
102 self.assertEqual(self._called, expected)
103
104 def test_start_control_panel_frozen(self):
105 """When frozen, the control-panel has a path."""
106 # I can't patch sys because frozen is not there by default
107 sys.frozen = True
108 self.addCleanup(delattr, sys, 'frozen')
109
110 root = 'Z:\\Yadda\\Yoo'
111 self.patch(os.path, 'abspath', lambda p: os.path.join(root, p))
112 self.patch(os.path, 'dirname', lambda p: p)
113 exe = 'foo\\bar\\baz\\'
114 self.patch(sys, 'executable', exe)
115
116 self.patch(subprocess, "Popen", self._set_called)
117
118 utils.start_control_panel()
119
120 path = os.path.join(root, exe, 'ubuntuone-control-panel-qt.exe')
121 expected = (([path, '--with-icon'],), {})
122 self.assertEqual(self._called, expected)
123
124
89class FakeRegistry(object):125class FakeRegistry(object):
126
90 """A fake registry."""127 """A fake registry."""
128
91 # pylint: disable=C0103129 # pylint: disable=C0103
92 HKEY_CURRENT_USER = 2130 HKEY_CURRENT_USER = 2
93 KEY_ALL_ACCESS = 4131 KEY_ALL_ACCESS = 4
@@ -126,6 +164,7 @@
126164
127165
128class AutostartTestCase(BaseTestCase):166class AutostartTestCase(BaseTestCase):
167
129 """Test add_syncdaemon_to_autostart."""168 """Test add_syncdaemon_to_autostart."""
130169
131 def setUp(self):170 def setUp(self):
@@ -138,12 +177,7 @@
138 """Check that the registry is updated correctly."""177 """Check that the registry is updated correctly."""
139 # I can't patch sys because frozen is not there by default178 # I can't patch sys because frozen is not there by default
140 sys.frozen = True179 sys.frozen = True
141180 self.addCleanup(delattr, sys, 'frozen')
142 def clean_frozen():
143 """Remove sys.frozen."""
144 del sys.frozen
145
146 self.addCleanup(clean_frozen)
147 utils.windows.add_syncdaemon_to_autostart()181 utils.windows.add_syncdaemon_to_autostart()
148 self.assertEqual(self.registry.connect_args,182 self.assertEqual(self.registry.connect_args,
149 ((None, self.registry.HKEY_CURRENT_USER), {}))183 ((None, self.registry.HKEY_CURRENT_USER), {}))
150184
=== modified file 'ubuntuone_installer/gui/qt/utils/windows.py'
--- ubuntuone_installer/gui/qt/utils/windows.py 2011-09-13 01:33:57 +0000
+++ ubuntuone_installer/gui/qt/utils/windows.py 2011-09-15 19:59:23 +0000
@@ -52,12 +52,11 @@
52 # If we are in windows and "frozen", assume it's in52 # If we are in windows and "frozen", assume it's in
53 # the same folder as this .exe53 # the same folder as this .exe
54 if hasattr(sys, "frozen"):54 if hasattr(sys, "frozen"):
55 cp_path = os.path.join(os.path.dirname(55 cp_dir = os.path.dirname(os.path.abspath(sys.executable))
56 os.path.abspath(sys.executable)),56 cp_path = os.path.join(cp_dir, "ubuntuone-control-panel-qt.exe")
57 "ubuntuone-control-panel-qt.exe")
58 else:57 else:
59 cp_path = "ubuntuone-control-panel-qt"58 cp_path = "ubuntuone-control-panel-qt"
60 subprocess.Popen([cp_path, ])59 subprocess.Popen([cp_path, "--with-icon"])
6160
6261
63def add_syncdaemon_to_autostart():62def add_syncdaemon_to_autostart():

Subscribers

People subscribed via source and target branches