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
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()
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()
def teardown_module(module): """ teardown created config session """ session.teardown_config_session()