Example #1
0
def test_class_inheritance(first_router_from_devices_yaml):
    ssh = task_24_1a.CiscoSSH(**first_router_from_devices_yaml)
    ssh.ssh.disconnect()
    assert isinstance(ssh,
                      BaseSSH), "Класс CiscoSSH должен наследовать BaseSSH"
    check_attr_or_method(ssh, method="send_show_command")
    check_attr_or_method(ssh, method="send_cfg_commands")
Example #2
0
def test_params_without_password(first_router_from_devices_yaml, monkeypatch):
    params = first_router_from_devices_yaml.copy()
    password = first_router_from_devices_yaml.get("password")
    del params["password"]
    monkeypatch.setattr("builtins.input", lambda x=None: password)
    try:
        ssh = task_24_1a.CiscoSSH(**params)
        ssh.ssh.disconnect()
    except SSHException:
        pytest.fail("Connection error")
Example #3
0
def test_class_inheritance(first_router_from_devices_yaml):
    r1 = task_24_1a.CiscoSSH(**first_router_from_devices_yaml)
    r1.ssh.disconnect()
    assert isinstance(r1, BaseSSH), "CiscoSSH class must inherit BaseSSH"
    check_attr_or_method(r1, method="send_show_command")
    check_attr_or_method(r1, method="send_cfg_commands")