Esempio n. 1
0
def test_purge_plugins():
    from sampleproject.toolkit.app import BaseApplication, MergedConfiguration

    app = BaseApplication()
    app.plugins = dict(destroyme=1, keepme=1)
    app.config = MergedConfiguration()
    app.config.update(dict(temboard=dict(plugins=['keepme'])))
    app.purge_plugins()
    assert 'destroyme' not in app.plugins
Esempio n. 2
0
def test_update_plugins(mocker):
    from sampleproject.toolkit.app import BaseApplication

    app = BaseApplication()

    unloadme = mocker.Mock(name='unloadme')
    old_plugins = dict(unloadme=unloadme)

    loadme = mocker.Mock(name='loadme')
    app.plugins = dict(loadme=loadme)

    app.update_plugins(old_plugins=old_plugins)

    assert loadme.load.called is True
    assert unloadme.unload.called is True