示例#1
0
def test_enable(first_router_from_devices_yaml):
    r1 = task_24_1.CiscoSSH(**first_router_from_devices_yaml)
    output = r1.send_show_command("sh run | i hostname")
    r1.ssh.disconnect()
    assert (
        "hostname" in output
    ), "При создании экземпляра класса должно создаваться подключение и переход в режим enable"
def test_enable(first_router_from_devices_yaml):
    r1 = task_24_1.CiscoSSH(**first_router_from_devices_yaml)
    output = r1.send_show_command("sh run | i hostname")
    r1.ssh.disconnect()
    assert (
        "hostname" in output
    ), "After creating an instance of the class, a connection must be created"
def test_class_inheritance(first_router_from_devices_yaml):
    ssh = task_24_1.CiscoSSH(**first_router_from_devices_yaml)
    assert isinstance(ssh,
                      BaseSSH), "Класс CiscoSSH должен наследовать BaseSSH"
    ssh.ssh.disconnect()
    check_attr_or_method(ssh, method="send_show_command")
    check_attr_or_method(ssh, method="send_cfg_commands")
def test_class_inheritance(first_router_from_devices_yaml):
    r1 = task_24_1.CiscoSSH(**first_router_from_devices_yaml)
    assert isinstance(r1, BaseSSH), "CiscoSSH class must inherit BaseSSH"
    r1.ssh.disconnect()
    check_attr_or_method(r1, method="send_show_command")
    check_attr_or_method(r1, method="send_cfg_commands")