Пример #1
0
    def test_emits_no_warnings_when_unused(self):
        func = settings.DeprecatedSetting(FakeSetting(result=None),
                                          message='what to do instead')
        func.warn = mock.Mock(spec_set=[])

        result = func({})

        assert result is None
        assert not func.warn.called
Пример #2
0
    def test_emits_warnings_when_child_setting_is_used(self):
        func = settings.DeprecatedSetting(FakeSetting(result={'foo': 'bar'}),
                                          message='what to do instead')
        func.warn = mock.Mock(spec_set=[])

        result = func({})

        assert result == {'foo': 'bar'}
        func.warn.assert_called_once_with('use of fake setting is '
                                          'deprecated: what to do instead')