示例#1
0
def test_set_iface_desc():
    """
    Test if the description of a giving interface is correctly set.
    """
    args = ['set','interfaces','ethernet','eth2','description','"This is a LAN interface"']
    handler = execUtils(list(args))
    success, out = handler.execmd()
    assert success == True
    session.commit()
    args = ['show','interfaces','ethernet','eth2','description']
    handler = execUtils(list(args))
    success, out = handler.execmd()
    assert args[0] == 'show'
    assert out.split('"')[1] == "This is a LAN interface"
示例#2
0
def test_commit_requiring_output():
    """
    Assert that none string returned value is not splitted as string
    """
    out = utils._run(
        '/opt/vyatta/sbin/my_set interfaces ethernet foobar description "This is a LAN interface"',
        output=True)
    assert session.commit() == True
def test_commit():
    """
    Test if changes are successfully commited
    """
    out = utils._run('/opt/vyatta/sbin/my_set interfaces ethernet eth2 description "This is a LAN interface"', output=True)
    #with pytest.raises(vsc.OperationFailed) as e:
    #    session.commit()
    assert session.commit() == True
示例#4
0
def test_set_iface_desc():
    """
    Test if the description of a giving interface is correctly set.
    """
    args = [
        'set', 'interfaces', 'ethernet', 'eth2', 'description',
        '"This is a LAN interface"'
    ]
    handler = execUtils(list(args))
    success, out = handler.execmd()
    assert success == True
    session.commit()
    args = ['show', 'interfaces', 'ethernet', 'eth2', 'description']
    handler = execUtils(list(args))
    success, out = handler.execmd()
    assert args[0] == 'show'
    assert out.split('"')[1] == "This is a LAN interface"
示例#5
0
def test_commit():
    """
    Test if changes are successfully commited
    """
    out = utils._run(
        '/opt/vyatta/sbin/my_set interfaces ethernet eth2 description "This is a LAN interface"',
        output=True)
    #with pytest.raises(vsc.OperationFailed) as e:
    #    session.commit()
    assert session.commit() == True
def test_commit_requiring_output():
    """
    Assert that none string returned value is not splitted as string
    """
    out = utils._run('/opt/vyatta/sbin/my_set interfaces ethernet foobar description "This is a LAN interface"', output=True)
    assert session.commit() == True