Пример #1
0
def test_not_in_session():
    """
    Assert that teardown_sesstion() fails whether session dosn't exist
    """
    assert session.teardown_config_session()
    assert not session.teardown_config_session()
    assert session.setup_config_session() == True
Пример #2
0
def test_not_in_session():
    """
    Assert that teardown_sesstion() fails whether session dosn't exist
    """
    assert session.teardown_config_session()
    assert not session.teardown_config_session()
    assert session.setup_config_session() == True    
Пример #3
0
def test_execmd_out_of_session():
    """
    Assert that config commands are not performed if vyos session is not set up
    """
    #teardown session because it is yet set up by setup_module()
    args = ['show','nat','source']
    session.teardown_config_session()
    #execmd would fail. Otherwise, there is a bug :p
    with pytest.raises(SessionNotExists) as e:
        handler = execUtils(args)
        handler.execmd()
    assert e.value.message == 'Configure session do not exists'
    #resetup session to continue executing remaining tests 
    session.setup_config_session()
Пример #4
0
def test_execmd_out_of_session():
    """
    Assert that config commands are not performed if vyos session is not set up
    """
    #teardown session because it is yet set up by setup_module()
    args = ['show', 'nat', 'source']
    session.teardown_config_session()
    #execmd would fail. Otherwise, there is a bug :p
    with pytest.raises(SessionNotExists) as e:
        handler = execUtils(args)
        handler.execmd()
    assert e.value.message == 'Configure session do not exists'
    #resetup session to continue executing remaining tests
    session.setup_config_session()
Пример #5
0
def teardown_module(module):
    """
    teardown created config session
    """
    session.teardown_config_session()
Пример #6
0
def teardown_module(module):
    """
    teardown created config session
    """
    session.teardown_config_session()