1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
"""examples.test_examples"""
import pytest
from .async_usage import async_iosxe_driver
from .basic_usage import factory, generic_driver, iosxe_driver, scrapli_driver
from .configuration_modes import eos_configure_session, iosxr_configure_exclusive
from .logging import basic_logging
from .ssh_keys import ssh_keys
from .structured_data import structured_data_genie
# simply making sure the examples don't blow up!
async def test_async_usage():
"""Test async usage example"""
await async_iosxe_driver.main()
@pytest.mark.parametrize(
"example_script",
[generic_driver, iosxe_driver, scrapli_driver, factory],
ids=["generic_driver", "iosxe_driver", "scrapli_driver", "scrapli_factory"],
)
def test_basic_usage(example_script):
"""Test basic usage example"""
example_script.main()
@pytest.mark.parametrize(
"example_script",
[iosxr_configure_exclusive, eos_configure_session],
ids=["iosxr_configure_exclusive", "eos_configure_session"],
)
def test_configuration_modes(example_script):
"""Test configuration mode example"""
example_script.main()
def test_logging():
"""Test logging example"""
basic_logging.main()
def test_ssh_keys():
"""Test ssh keys example"""
ssh_keys.main()
@pytest.mark.parametrize(
"example_script",
[structured_data_genie, structured_data_genie],
ids=["genie", "textfsm"],
)
def test_structured_data(example_script):
"""Test structured data example"""
example_script.main()
|