~thelinuxguy/openlp/fix-version-check

« back to all changes in this revision

Viewing changes to tests/functional/openlp_core/common/test_settings.py

  • Committer: Tim Bentley
  • Date: 2017-12-17 14:02:03 UTC
  • mfrom: (2792.1.17 fixes)
  • Revision ID: tim.bentley@gmail.com-20171217140203-k9fg0sv6of9qinjd
Refactor asserts in api and common packages

lp:~trb143/openlp/asserts (revision 2809)
https://ci.openlp.io/job/Branch-01-Pull/2354/                          [SUCCESS]
https://ci.openlp.io/job/Branch-02-Functional-Tests/2255/              [SUCCESS]
https://ci.openlp.io/job/Branch-03-Interface-Tests/2120/               [SUCCESS]
https://ci.openlp.io/job/Branch-04a-Code_Analysis/1446/                [SUCCESS]
https://ci.openlp.io/job/Branch-04b-Test_Coverage/1263/                [SUCCESS]
https...

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
        extend = settings.value('extend')
140
140
 
141
141
        # THEN the default value is returned
142
 
        self.assertEqual('very wide', extend, 'The default value defined should be returned')
 
142
        assert 'very wide' == extend, 'The default value defined should be returned'
143
143
 
144
144
        # WHEN a new value is saved into config
145
145
        Settings().setValue('test/extend', 'very short')
146
146
 
147
147
        # THEN the new value is returned when re-read
148
 
        self.assertEqual('very short', Settings().value('test/extend'), 'The saved value should be returned')
 
148
        assert 'very short' == Settings().value('test/extend'), 'The saved value should be returned'
149
149
 
150
150
    def test_settings_nonexisting(self):
151
151
        """Test the Settings on query for non-existing value"""
155
155
            Settings().value('core/does not exists')
156
156
 
157
157
        # THEN: An exception with the non-existing key should be thrown
158
 
        self.assertEqual(str(cm.exception), "'core/does not exists'", 'We should get an exception')
 
158
        assert str(cm.exception) == "'core/does not exists'", 'We should get an exception'
159
159
 
160
160
    def test_extend_default_settings(self):
161
161
        """Test that the extend_default_settings method extends the default settings"""
167
167
            Settings.extend_default_settings({'test/setting 3': 4, 'test/extended 1': 1, 'test/extended 2': 2})
168
168
 
169
169
            # THEN: The _default_settings__ dictionary_ should have the new keys
170
 
            self.assertEqual(
171
 
                Settings.__default_settings__, {'test/setting 1': 1, 'test/setting 2': 2, 'test/setting 3': 4,
172
 
                                                'test/extended 1': 1, 'test/extended 2': 2})
 
170
            assert Settings.__default_settings__ == {'test/setting 1': 1, 'test/setting 2': 2, 'test/setting 3': 4,
 
171
                                                     'test/extended 1': 1, 'test/extended 2': 2}
173
172
 
174
173
    @patch('openlp.core.common.settings.QtCore.QSettings.contains')
175
174
    @patch('openlp.core.common.settings.QtCore.QSettings.value')