Ejemplo n.º 1
0
def test_configuration_initialize():
    s = "hello"
    config = {conf.fatal_error_suggestion.__name__: s}
    fsrw = MagicMock()
    fsrw.path = ""
    read_lines = MagicMock(return_value=[json.dumps(config)])
    fsrw.read_lines = read_lines
    fsrw_class = MagicMock(return_value=fsrw)
    conf.initialize(fsrw_class)
    assert conf._overrides is not None
    assert_equals(conf._overrides, config)
    assert_equals(conf.fatal_error_suggestion(), s)
Ejemplo n.º 2
0
def test_configuration_initialize():
    s = "hello"
    config = { conf.fatal_error_suggestion.__name__: s }
    fsrw = MagicMock()
    fsrw.path = ""
    read_lines = MagicMock(return_value=[json.dumps(config)])
    fsrw.read_lines = read_lines
    fsrw_class = MagicMock(return_value=fsrw)
    conf.initialize(fsrw_class)
    assert conf._overrides is not None
    assert_equals(conf._overrides, config)
    assert_equals(conf.fatal_error_suggestion(), s)
Ejemplo n.º 3
0
def test_configuration_initialize_lazy():
    """Tests that the initialize function has no behavior if the override dict is already initialized"""
    conf.override_all({})
    fsrw_class = MagicMock(side_effect=ValueError)
    conf.initialize(fsrw_class)
Ejemplo n.º 4
0
def test_configuration_initialize_lazy():
    """Tests that the initialize function has no behavior if the override dict is already initialized"""
    conf.override_all({})
    fsrw_class = MagicMock(side_effect=ValueError)
    conf.initialize(fsrw_class)