~xubuntu-dev/ubiquity/lp1437180_feh

« back to all changes in this revision

Viewing changes to tests/test_language.py

  • Committer: Colin Watson
  • Date: 2012-07-16 14:29:13 UTC
  • Revision ID: cjwatson@canonical.com-20120716142913-hh1qmfjejxa9dfyb
Make all Python code pass pep8(1), and add a test to enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
from ubiquity import i18n, plugin_manager
15
15
from helpers import builtin_patch
16
16
 
 
17
 
17
18
def side_effect_factory(real_method):
18
19
    new_path = 'd-i/source/localechooser/debian/localechooser' \
19
20
               '/usr/share/localechooser/languagelist.data.gz'
 
21
 
20
22
    def side_effect(path, *args, **kw):
21
23
        if path.endswith('languagelist.data.gz'):
22
24
            return real_method(new_path, *args, **kw)
23
25
        else:
24
26
            return real_method(path, *args, **kw)
 
27
 
25
28
    return side_effect
26
29
 
 
30
 
27
31
class OEMUserLanguageTests(unittest.TestCase):
28
32
    def setUp(self):
29
33
        for obj in ('ubiquity.misc.execute',
74
78
 
75
79
class LanguageTests(unittest.TestCase):
76
80
    def setUp(self):
77
 
        
78
81
        for obj in ('ubiquity.misc.execute',
79
82
                'ubiquity.misc.execute_root'):
80
83
            patcher = mock.patch(obj)
95
98
 
96
99
    def test_try_ubuntu_clicks(self):
97
100
        from ubiquity import gtkwidgets
 
101
 
98
102
        # Ensure that the mock changes state correctly.
99
103
        self.controller.allowed_change_step.return_value = True
 
104
 
100
105
        def side_effect(*args):
101
106
            assert len(args) == 1 and type(args[0]) is bool
102
107
            self.controller.allowed_change_step.return_value = args[0]
 
108
 
103
109
        self.controller.allow_change_step.side_effect = side_effect
104
110
        # Multiple clicks on Try Ubuntu crash the installer.  LP: #911907
105
111
        self.gtk.try_ubuntu.clicked()