Ejemplo n.º 1
0
def test_local():

    channel = LocalChannel(None, None)

    ec, out, err = channel.execute_wait('echo "pwd: $PWD"', 2)

    assert ec == 0, "Channel execute failed"
    print("Stdout: ", out)
    print("Stderr: ", err)
Ejemplo n.º 2
0
def test_env():
    ''' Regression testing for issue #27
    '''

    lc = LocalChannel()
    rc, stdout, stderr = lc.execute_wait("env", 1)

    stdout = stdout.split('\n')
    x = [l for l in stdout if l.startswith("PATH=")]
    assert x, "PATH not found"

    x = [l for l in stdout if l.startswith("HOME=")]
    assert x, "HOME not found"

    print("RC:{} \nSTDOUT:{} \nSTDERR:{}".format(rc, stdout, stderr))
Ejemplo n.º 3
0
def test_env_mod():
    ''' Testing for env update at execute time.
    '''

    lc = LocalChannel()
    rc, stdout, stderr = lc.execute_wait("env", 1, {'TEST_ENV': 'fooo'})

    stdout = stdout.split('\n')
    x = [l for l in stdout if l.startswith("PATH=")]
    assert x, "PATH not found"

    x = [l for l in stdout if l.startswith("HOME=")]
    assert x, "HOME not found"

    x = [l for l in stdout if l.startswith("TEST_ENV=fooo")]
    assert x, "User set env missing"