86
88
self.assertEqual(0, self._called[0][5])
91
class StartControlPanelTestCase(BaseTestCase):
93
"""Test the start of the control panel."""
95
def test_start_control_panel(self):
96
"""The proper process is started."""
97
self.patch(subprocess, "Popen", self._set_called)
99
utils.start_control_panel()
101
expected = ((['ubuntuone-control-panel-qt', '--with-icon'],), {})
102
self.assertEqual(self._called, expected)
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
108
self.addCleanup(delattr, sys, 'frozen')
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)
116
self.patch(subprocess, "Popen", self._set_called)
118
utils.start_control_panel()
120
path = os.path.join(root, exe, 'ubuntuone-control-panel-qt.exe')
121
expected = (([path, '--with-icon'],), {})
122
self.assertEqual(self._called, expected)
89
125
class FakeRegistry(object):
90
127
"""A fake registry."""
91
129
# pylint: disable=C0103
92
130
HKEY_CURRENT_USER = 2
93
131
KEY_ALL_ACCESS = 4
138
177
"""Check that the registry is updated correctly."""
139
178
# I can't patch sys because frozen is not there by default
140
179
sys.frozen = True
143
"""Remove sys.frozen."""
146
self.addCleanup(clean_frozen)
180
self.addCleanup(delattr, sys, 'frozen')
147
181
utils.windows.add_syncdaemon_to_autostart()
148
182
self.assertEqual(self.registry.connect_args,
149
183
((None, self.registry.HKEY_CURRENT_USER), {}))