Beispiel #1
0
    def test_misconfigured_object_path(self):
        settings = LazySettings('tests.samples.non_existing_module.Config')
        settings.add_strategy(SettingsLoadStrategyPythonObj)

        with pytest.raises(RuntimeError):
            settings.as_dict()

        settings = LazySettings('tests.samples.python_obj.non_existing_class')
        settings.add_strategy(SettingsLoadStrategyPythonObj)

        with pytest.raises(RuntimeError):
            settings.as_dict()
Beispiel #2
0
    def test_should_not_read_non_class_settings_value(self):
        settings = LazySettings('tests.samples.python_obj.config_invalid')
        settings.add_strategy(SettingsLoadStrategyPythonObj)

        with pytest.raises(RuntimeError):
            settings.as_dict()
Beispiel #3
0
    def test_should_read_class_settings_value(self):
        settings = LazySettings('tests.samples.python_obj.MyConfig')
        settings.add_strategy(SettingsLoadStrategyPythonObj)

        assert settings.START_URLS == ['https://www.google.com']
        assert settings.AUTO_CONNECT == True