Exemplo n.º 1
0
def test_bootstrap(mocker):
    mod = 'sampleproject.toolkit.app'
    mocker.patch(mod + '.BaseApplication.read_file', autospec=True)
    mocker.patch(mod + '.BaseApplication.read_dir', autospec=True)
    mocker.patch(mod + '.BaseApplication.apply_config', autospec=True)
    mocker.patch(mod + '.MergedConfiguration')
    from sampleproject.toolkit.app import BaseApplication

    app = BaseApplication()
    app.config.temboard.configfile = 'pouet'
    app.bootstrap(args=None, environ={})

    assert repr(app)
Exemplo n.º 2
0
def test_bootstrap(caplog, mocker):
    mod = 'sampleproject.toolkit.app'
    fc = mocker.patch(mod + '.BaseApplication.find_config_file', autospec=True)
    mocker.patch(mod + '.BaseApplication.read_file', autospec=True)
    mocker.patch(mod + '.BaseApplication.read_dir', autospec=True)
    mocker.patch(mod + '.BaseApplication.apply_config', autospec=True)
    mocker.patch(mod + '.MergedConfiguration')
    from sampleproject.toolkit.app import BaseApplication

    app = BaseApplication()
    fc.return_value = 'pouet'
    app.bootstrap(args=None, environ={})
    assert not caplog.records

    assert repr(app)

    # No config file is ok.
    caplog.clear()
    app.config.temboard.configfile = None
    fc.return_value = None
    app.bootstrap(args=None, environ={})
    assert caplog.records
    assert "No config file" in caplog.records[0].message