Esempio n. 1
0
def test_get_blob():
	"test to get blob with spefied commit id."
	repo = git.Repo(get_repodir())
	blob = repo.get_blob('test_get.sh')
	assert blob.name == 'test_get.sh'

	blob = repo.get_blob('test_2.sh')
	assert blob.name == 'test_2.sh'
from lazyscript.script import SourceList
from t import get_repodir, get_datadir

source_list = SourceList(get_datadir()+'/source.list')
repo_path = get_repodir()

def test_save_list():
	"test to save source list."
	list = []
	list.append({'name':'firstscript',
			   'tag':'vim',
			   'category':'editor',
			   'repo':repo_path,
			   'ver':''})
	
	source_list.save(list)

def test_load_list():
	"test to load source list."
	source_list.update()
	assert source_list.items()[0]['name'] == 'firstscript',\
			"can not load source."
Esempio n. 3
0
from lazyscript.script import ScriptSet, SourceList
from t import get_repodir, get_datadir

set = ScriptSet.from_repo(get_repodir())


def test_get_script():
    "test to get script."
    script = set.get("firstscript")
    assert script.name == "hellovim", "can not get dirbase script."


# 	script = set.get('onefilescript.sh')
# 	assert script.name == 'onefirstscript.sh', 'can not get filebase script.'


def test_get_categories():
    "test to get categories form source list"
    set = ScriptSet.from_sourcelist(SourceList(get_datadir() + "/source.list"))
    assert set.categories("editor")[0].name == "hellovim", set.categories
Esempio n. 4
0
def test_from_repo():
	"test to create a source list from a git repositry."
	list = ScriptsList.from_repo(remote_repo, get_repodir())
	list.path = get_datadir()+'/scripts.list'
	list.save()
Esempio n. 5
0
from lazyscripts.category import Category
from lazyscripts.script import ScriptSet, ScriptsList, ScriptsBuilder
from lazyscripts.repo import git, sign_repopath
from t import get_repodir, get_datadir, remote_repo

set = ScriptSet.from_scriptslist(
            ScriptsList(get_datadir()+'/scripts.list'), True)

_repos = {remote_repo:git.Repo(get_repodir()+'/'+sign_repopath(remote_repo))}
_cat = Category(name='Networking', scripts_builder=ScriptsBuilder(_repos))
e = {'repo': remote_repo, 
    'category': 'Networking',
    'name': 'ie6', 
    'id': 'ie6',
    'selected':False}
_cat.add_entry(e)

def test_get_script_from_category():
    "test to get script form a category."
    assert 'Script' == _cat.get('ie6').__class__.__name__

def test_get_categories():
    'test to get categories form scripts list'
    # checks all items are Category class.
    for category in set.categories():
        assert 'Category' == category.__class__.__name__, category.__class__

    # checks get Category Instance by spefied category name.
    ast_cats = ['Networking', 'Graphic', 'Localization', 
                'Productivity', 'Entertain', 'Customize','Game', 
                'Multimedia']
Esempio n. 6
0
def test_create_scriptrepo():
	"test to create an ensure the local repositery is unique."
	try:
		signed_repopath = sign_repopath(get_repodir(), get_datadir()+'unexist/')
	except NoScriptPoll, e:
		assert 1 != 2, 'can not avoid the script poll not exists.'
Esempio n. 7
0
# -*- encoding=utf8 -*-
from lazyscript.repo import git, create_scriptrepo, sign_repopath, NoScriptPoll
from t import get_repodir,get_datadir

repo = git.Repo(get_repodir())

def test_create_scriptrepo():
	"test to create an ensure the local repositery is unique."
	try:
		signed_repopath = sign_repopath(get_repodir(), get_datadir()+'unexist/')
	except NoScriptPoll, e:
		assert 1 != 2, 'can not avoid the script poll not exists.'

	signed_repopath = sign_repopath(get_repodir(), get_datadir()+'scriptpoll/')
	want_path = signed_repopath+'/.git'

	repo = create_scriptrepo(get_repodir(), get_datadir()+'scriptpoll/')
	assert repo.path == signed_repopath+'/.git', repo.path

	# clean
	import os
	os.system('rm -rf '+signed_repopath)

def test_get_blob():
	"test to get blob with spefied commit id."
	repo = git.Repo(get_repodir())
	blob = repo.get_blob('test_get.sh')
	assert blob.name == 'test_get.sh'

	blob = repo.get_blob('test_2.sh')
	assert blob.name == 'test_2.sh'