Example #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 == [] )
Example #2
0
def testRecipeDefaultDownload():
    recipe = Recipe({"name":"test"})
    assert(recipe.download == [])
Example #3
0
def testRecipeValidStrCheck():
    recipe = Recipe({"name":"test", "check":"command"})
    assert(recipe.check[0] == "command")
Example #4
0
def testRecipeValidListCheck():
    recipe = Recipe({"name":"test", "check": ["command1","command2"]})
    assert(recipe.check == ["command1","command2"])
Example #5
0
def testRecipeDefaultCheck():
    recipe = Recipe({"name":"test"})
    assert(recipe.check == [])
Example #6
0
def testRecipeValidStrInstall():
    recipe = Recipe({"name":"test", "install":"command"})
    assert(recipe.install[0] == "command")
Example #7
0
def testRecipeNoName():
    recipe = Recipe({})
Example #8
0
def testRecipeInvalidDict():
    recipe = Recipe("something")
Example #9
0
def testRecipeValidStrDependencies():
    recipe = Recipe({"name":"test", "dependencies": "blah"})
    assert(recipe.dependencies == ["blah"] )
Example #10
0
def testRecipeValidListDependencies():
    recipe = Recipe({"name":"test", "dependencies": ["dep1","dep2"]})
    assert(recipe.dependencies == ["dep1","dep2"])
Example #11
0
def testRecipeDefaultDependencies():
    recipe = Recipe({"name":"test"})
    assert(recipe.dependencies == [])
Example #12
0
def testRecipeValid():
    recipe = Recipe({"name":"test", "version":"3.7"})
    assert(recipe.name == "test")
    assert(recipe.version == "3.7")
Example #13
0
def testRecipeDefaultVersion0():
    recipe = Recipe({"name":"test"})
    assert(recipe.version == "0")
Example #14
0
def testRecipeEmptyName():
    recipe = Recipe({"name":""})
Example #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 )
Example #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"])
Example #17
0
def testRecipeDownloadSingle():
    recipe = Recipe({"name":"test", "download":["http://domain.tld/file.tgz"]})
    assert(recipe.download == ["http://domain.tld/file.tgz"])
Example #18
0
def testRecipeDefaultInstall():
    recipe = Recipe({"name":"test"})
    assert(recipe.install == [])
Example #19
0
def testRecipeValidListInstall():
    recipe = Recipe({"name":"test", "install": ["command1","command2"]})
    assert(recipe.install == ["command1","command2"])
Example #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 )