19
19
"""Tests for the services tab."""
21
from twisted.internet import defer
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
39
@defer.inlineCallbacks
41
yield super(ServicesPanelTestCase, self).setUp()
42
self.ui.backend.next_result = SAMPLE_ACCOUNT_INFO
37
44
def test_is_processing_while_asking_info(self):
38
45
"""The ui is processing while the contents are loaded."""
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
43
51
self.patch(self.ui.backend, 'account_info', check)
45
53
return self.ui.load() # trigger the info request
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)
59
self.assertFalse(self.ui.is_processing)
61
@defer.inlineCallbacks
62
def test_info_is_requested_on_load(self):
63
"""The info is requested to the backend."""
65
self.assert_backend_called('account_info')
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)
52
72
def test_mobile_plan_modify_button(self):