Пример #1
0
def test_on_config_changed(configdata_init, hook, module, option_filter,
                           option, called):
    module.info.config_changed_hooks = [(option_filter, hook)]

    info = loader.ExtensionInfo(name='testmodule')
    loader._load_component(info)
    loader._on_config_changed(option)

    assert hook.called == called
Пример #2
0
def test_on_config_changed(configdata_init, hook, module,
                           option_filter, option, called):
    module.info.config_changed_hooks = [(option_filter, hook)]

    info = loader.ExtensionInfo(name='testmodule')
    loader._load_component(info)
    loader._on_config_changed(option)

    assert hook.called == called
Пример #3
0
def test_skip_hooks(hook, module):
    hook.raising = True

    module.info.init_hook = hook
    module.info.config_changed_hooks = [(None, hook)]

    info = loader.ExtensionInfo(name='testmodule')
    loader._load_component(info, skip_hooks=True)
    loader._on_config_changed('test')

    assert not hook.called
Пример #4
0
def test_skip_hooks(hook, module):
    hook.raising = True

    module.info.init_hook = hook
    module.info.config_changed_hooks = [(None, hook)]

    info = loader.ExtensionInfo(name='testmodule')
    loader._load_component(info, skip_hooks=True)
    loader._on_config_changed('test')

    assert not hook.called
Пример #5
0
def test_load_component(monkeypatch):
    monkeypatch.setattr(objects, 'commands', {})

    info = loader.ExtensionInfo(name='qutebrowser.components.scrollcommands')
    mod = loader._load_component(info, skip_hooks=True)

    assert hasattr(mod, 'scroll_to_perc')
    assert 'scroll-to-perc' in objects.commands
Пример #6
0
def test_load_component(monkeypatch):
    monkeypatch.setattr(objects, 'commands', {})

    info = loader.ExtensionInfo(name='qutebrowser.components.scrollcommands')
    mod = loader._load_component(info, skip_hooks=True)

    assert hasattr(mod, 'scroll_to_perc')
    assert 'scroll-to-perc' in objects.commands
Пример #7
0
def test_init_hook(hook, module):
    module.info.init_hook = hook
    info = loader.ExtensionInfo(name='testmodule')
    loader._load_component(info)
    assert hook.called
Пример #8
0
def test_init_hook(hook, module):
    module.info.init_hook = hook
    info = loader.ExtensionInfo(name='testmodule')
    loader._load_component(info)
    assert hook.called