예제 #1
0
def testRecipeLoadFile():
    recipe = Recipe.loadFile("zlib-1.2.11.yaml")
    assert( recipe.name == "zlib" )
    assert( recipe.version == "1.2.11" )
    assert( recipe.check == ["test -r ${LIBDIR}/libz.so","test -r ${INCDIR}/zlib.h"] )
    assert( len(recipe.install) == 5 )
    assert( recipe.dependencies == [] )
예제 #2
0
def testRecipeDefaultDownload():
    recipe = Recipe({"name":"test"})
    assert(recipe.download == [])
예제 #3
0
def testRecipeValidStrCheck():
    recipe = Recipe({"name":"test", "check":"command"})
    assert(recipe.check[0] == "command")
예제 #4
0
def testRecipeValidListCheck():
    recipe = Recipe({"name":"test", "check": ["command1","command2"]})
    assert(recipe.check == ["command1","command2"])
예제 #5
0
def testRecipeDefaultCheck():
    recipe = Recipe({"name":"test"})
    assert(recipe.check == [])
예제 #6
0
def testRecipeValidStrInstall():
    recipe = Recipe({"name":"test", "install":"command"})
    assert(recipe.install[0] == "command")
예제 #7
0
def testRecipeNoName():
    recipe = Recipe({})
예제 #8
0
def testRecipeInvalidDict():
    recipe = Recipe("something")
예제 #9
0
def testRecipeValidStrDependencies():
    recipe = Recipe({"name":"test", "dependencies": "blah"})
    assert(recipe.dependencies == ["blah"] )
예제 #10
0
def testRecipeValidListDependencies():
    recipe = Recipe({"name":"test", "dependencies": ["dep1","dep2"]})
    assert(recipe.dependencies == ["dep1","dep2"])
예제 #11
0
def testRecipeDefaultDependencies():
    recipe = Recipe({"name":"test"})
    assert(recipe.dependencies == [])
예제 #12
0
def testRecipeValid():
    recipe = Recipe({"name":"test", "version":"3.7"})
    assert(recipe.name == "test")
    assert(recipe.version == "3.7")
예제 #13
0
def testRecipeDefaultVersion0():
    recipe = Recipe({"name":"test"})
    assert(recipe.version == "0")
예제 #14
0
def testRecipeEmptyName():
    recipe = Recipe({"name":""})
예제 #15
0
def testRunRecipeFailedInstall():
    recipe = Recipe({"name": "libtest", "version": "1.3", "check": ["test -f /usr/local/lib/libtest.so","test -f /usr/local/include/test.h"], "install":["wget http://test/test.tgz", "tar xzf test.tgz", "cd test && make install"] })
    expected = [ call("test -f /usr/local/lib/libtest.so",shell=True), call("wget http://test/test.tgz",shell=True) ]
    with patch("subprocess.call", side_effect = [1,1] ) as mock:
        assert_raises( FailedRecipeError, runRecipe, recipe)
        assert( mock.mock_calls == expected )
예제 #16
0
def testRecipeDownloadList():
    recipe = Recipe({"name":"test", "download":["http://domain.tld/file.tgz","http://domain.tld/anotherfile"]})
    assert(recipe.download == ["http://domain.tld/file.tgz","http://domain.tld/anotherfile"])
예제 #17
0
def testRecipeDownloadSingle():
    recipe = Recipe({"name":"test", "download":["http://domain.tld/file.tgz"]})
    assert(recipe.download == ["http://domain.tld/file.tgz"])
예제 #18
0
def testRecipeDefaultInstall():
    recipe = Recipe({"name":"test"})
    assert(recipe.install == [])
예제 #19
0
def testRecipeValidListInstall():
    recipe = Recipe({"name":"test", "install": ["command1","command2"]})
    assert(recipe.install == ["command1","command2"])
예제 #20
0
def testRunRecipeCheckTrue():
    recipe = Recipe({"name": "libtest", "version": "1.3", "check": ["test -f /usr/local/lib/libtest.so","test -f /usr/local/include/test.h"], "install":["wget http://test/test.tgz", "tar xzf test.tgz", "cd test && make install"] })
    expected = [ call("test -f /usr/local/lib/libtest.so",shell=True) , call("test -f /usr/local/include/test.h",shell=True) ]
    with patch("subprocess.call", return_value = 0) as mock:
        runRecipe(recipe)
        assert( mock.mock_calls == expected )