~chipaca/ubuntuone-control-panel/diego-sarmentero-delivers

« back to all changes in this revision

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

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2011-06-22 14:31:27 UTC
  • mfrom: (166.1.4 refactor-devices)
  • Revision ID: tarmac-20110622143127-gm951a9azigs9tm3
- Device and account info is now loaded just like other widgets (independently from their parents).
- Device info is no longer faked, and local device is also a DeviceWidget (LP: #800362).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
"""Tests for the services tab."""
20
20
 
 
21
from twisted.internet import defer
 
22
 
21
23
from ubuntuone.controlpanel.gui.qt import services as gui
22
24
from ubuntuone.controlpanel.gui.qt.tests import (
23
25
    SAMPLE_ACCOUNT_INFO, SAMPLE_PLAN,
34
36
    innerclass_name = "Ui_Form"
35
37
    class_ui = gui.ServicesPanel
36
38
 
 
39
    @defer.inlineCallbacks
 
40
    def setUp(self):
 
41
        yield super(ServicesPanelTestCase, self).setUp()
 
42
        self.ui.backend.next_result = SAMPLE_ACCOUNT_INFO
 
43
 
37
44
    def test_is_processing_while_asking_info(self):
38
45
        """The ui is processing while the contents are loaded."""
39
46
        def check():
40
47
            """The ui must be is_processing."""
41
48
            self.assertTrue(self.ui.is_processing, 'ui must be processing')
 
49
            return SAMPLE_ACCOUNT_INFO
42
50
 
43
51
        self.patch(self.ui.backend, 'account_info', check)
44
52
 
45
53
        return self.ui.load()  # trigger the info request
46
54
 
47
 
    def test_update_account_info(self):
 
55
    def test_is_not_processing_after_info_ready(self):
 
56
        """The ui is not processing when contents are load."""
 
57
        self.ui.process_info(SAMPLE_ACCOUNT_INFO)
 
58
 
 
59
        self.assertFalse(self.ui.is_processing)
 
60
 
 
61
    @defer.inlineCallbacks
 
62
    def test_info_is_requested_on_load(self):
 
63
        """The info is requested to the backend."""
 
64
        yield self.ui.load()
 
65
        self.assert_backend_called('account_info')
 
66
 
 
67
    def test_process_info(self):
48
68
        """Backend's file sync status changed callback is connected."""
49
 
        self.ui.update_account_info(SAMPLE_ACCOUNT_INFO)
 
69
        self.ui.process_info(SAMPLE_ACCOUNT_INFO)
50
70
        self.assertEqual(self.ui.ui.storage_plan_label.text(), SAMPLE_PLAN)
51
71
 
52
72
    def test_mobile_plan_modify_button(self):