~nataliabidart/ubuntuone-control-panel/import-qt4reactor

« back to all changes in this revision

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

- Show special legends to the user when s/he has run out of quota (LP: #828983).

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
        msg = gui.PERCENTAGE_LABEL % percentage_usage
122
122
        self.assertEqual(self.ui.ui.percentage_usage_label.text(), msg)
123
123
 
 
124
    def test_update_over_quota(self):
 
125
        """Check the labels state when the user exceed the quota."""
 
126
        percentage_value = 100
 
127
        # pylint: disable=W0212
 
128
        self.ui._update_quota({'percentage': percentage_value})
 
129
        # pylint: enable=W0212
 
130
 
 
131
        self.assertTrue(
 
132
            self.ui.ui.percentage_usage_label.property("OverQuota").toBool())
 
133
        self.assertTrue(
 
134
            self.ui.ui.quota_usage_label.property("OverQuota").toBool())
 
135
 
 
136
    def test_update_quota_in_range(self):
 
137
        """Check the labels state when the quota is under the threshold."""
 
138
        percentage_value = 50
 
139
        # pylint: disable=W0212
 
140
        self.ui._update_quota({'percentage': percentage_value})
 
141
        # pylint: enable=W0212
 
142
 
 
143
        self.assertFalse(
 
144
            self.ui.ui.percentage_usage_label.property("OverQuota").toBool())
 
145
        self.assertFalse(
 
146
            self.ui.ui.quota_usage_label.property("OverQuota").toBool())
 
147
 
124
148
    def test_on_local_device_removed(self):
125
149
        """On DeviesPanel's localDeviceRemoved, emit credentialsNotFound."""
126
150
        self.ui.ui.devices_tab.localDeviceRemoved.emit()