~ralsina/ubuntuone-control-panel/unique_in_ubuntu

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/tests/test_start.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart, Manuel de la Pena
  • Date: 2012-04-05 18:07:56 UTC
  • mfrom: (307.1.6 autoupdate)
  • Revision ID: tarmac-20120405180756-bwh9460pl303hfwi
- Check for updates when the main window is shown. On linux, this is a no
operation. On windows, this will check for new versions of the software and
will prompt the user for confirmation to install updates (LP: #971455).

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
    def __init__(self):
36
36
        self.args = []
 
37
        self.updates_checked = defer.Deferred()
37
38
 
38
39
    def __call__(self, *args, **kwargs):
39
40
        self.args.append((args, kwargs))
50
51
        """Save the new geometry."""
51
52
        self.style = style
52
53
 
 
54
    def check_updates(self):
 
55
        """Fake the check updates call."""
 
56
        self.updates_checked.callback(None)
 
57
        return self.updates_checked
 
58
 
53
59
 
54
60
class StartTestCase(TestCase):
55
61
    """Test the qt control panel."""
56
62
 
 
63
    timeout = 2
 
64
 
57
65
    @defer.inlineCallbacks
58
66
    def setUp(self):
59
67
        yield super(StartTestCase, self).setUp()
106
114
                        gui.QtCore.Qt.AlignCenter, self.main_window.size(),
107
115
                        app.desktop().availableGeometry())
108
116
        self.assertEqual(self.main_window.style, expected)
 
117
 
 
118
    @defer.inlineCallbacks
 
119
    def test_updates_are_checked(self):
 
120
        """When creating the window, updates are checked."""
 
121
        gui.start(close_callback=self.close_cb)
 
122
 
 
123
        # a timeout in this test means that the check_updates method
 
124
        # was not called
 
125
        yield self.main_window.updates_checked