Source

pida-hacks / pida / services / plugins / test_install.py

Full commit
import py
import pida
from .packer import pack_plugin

from pida.core.environment import plugins_path, home


from .plugins import Plugins
from .metadata import from_plugin

p = py.path.local(pida.__file__).dirpath().dirpath().join('pida-plugins')

from mock import Mock

def setup_module(mod):
    mod.example_plugin = pack_plugin(p.strpath, 'bookmark')


def test_install():
    print plugins_path
    boss = Mock()
    boss.loader.get_all_service_files.return_value = []
    boss.get_plugins.return_value = []
    service = Plugins(boss)
    service.create_all()
    service._check = True
    service._view = boss.view
    service._loader = boss.loader
    service.start()
    
    info = from_plugin(p.strpath, 'bookmark')
    service.install(info, example_plugin)

    newpath = home('plugins/bookmark')
    assert newpath.check(dir=1)