示例#1
0
def test_function_return_value_different_args():
    """
    Checking the function with different arguments
    """
    access_vlans_mapping = {
        "FastEthernet0/1": 101,
        "FastEthernet0/4": 121,
    }
    template_access_mode = [
        "switchport mode access",
        "switchport access vlan",
    ]
    correct_return_value = [
        "interface FastEthernet0/1",
        "switchport mode access",
        "switchport access vlan 101",
        "interface FastEthernet0/4",
        "switchport mode access",
        "switchport access vlan 121",
    ]

    return_value = task_9_1.generate_access_config(access_vlans_mapping,
                                                   template_access_mode)
    assert return_value != None, "The function returns None"
    assert (
        type(return_value) == list
    ), f"The function should return a list, instead it returns a {type(return_value).__name__}"
    assert correct_return_value == return_value, "Function returns wrong value"
示例#2
0
def test_function_return_value_different_args():
    """
    Проверка работы функции с другими аргументами
    """
    access_vlans_mapping = {
        "FastEthernet0/1": 101,
        "FastEthernet0/4": 121,
    }
    template_access_mode = [
        "switchport mode access",
        "switchport access vlan",
    ]
    correct_return_value = [
        "interface FastEthernet0/1",
        "switchport mode access",
        "switchport access vlan 101",
        "interface FastEthernet0/4",
        "switchport mode access",
        "switchport access vlan 121",
    ]

    return_value = task_9_1.generate_access_config(
        access_vlans_mapping, template_access_mode
    )
    assert return_value != None, "Функция ничего не возвращает"
    assert (
        type(return_value) == list
    ), f"По заданию функция должна возвращать список, а возвращает {type(return_value).__name__}"
    assert (
        return_value == correct_return_value
    ), "Функция возвращает неправильное значение"
示例#3
0
def test_function_return_value():
    access_vlans_mapping = {
        'FastEthernet0/12': 10,
        'FastEthernet0/14': 11,
        'FastEthernet0/16': 17
    }
    template_access_mode = [
        'switchport mode access', 'switchport access vlan',
        'switchport nonegotiate', 'spanning-tree portfast',
        'spanning-tree bpduguard enable'
    ]
    correct_return_value = [
        'interface FastEthernet0/12', 'switchport mode access',
        'switchport access vlan 10', 'switchport nonegotiate',
        'spanning-tree portfast', 'spanning-tree bpduguard enable',
        'interface FastEthernet0/14', 'switchport mode access',
        'switchport access vlan 11', 'switchport nonegotiate',
        'spanning-tree portfast', 'spanning-tree bpduguard enable',
        'interface FastEthernet0/16', 'switchport mode access',
        'switchport access vlan 17', 'switchport nonegotiate',
        'spanning-tree portfast', 'spanning-tree bpduguard enable'
    ]

    return_value = task_9_1.generate_access_config(access_vlans_mapping,
                                                   template_access_mode)
    assert return_value != None, "Функция ничего не возвращает"
    assert type(return_value) == list, "Функция должна возвращать список"
    assert return_value == correct_return_value, "Функция возвращает неправильное значение"
示例#4
0
def test_function_return_value():
    access_vlans_mapping = {
        'FastEthernet0/12': 10,
        'FastEthernet0/14': 11,
        'FastEthernet0/16': 17
    }
    template_access_mode = [
        'switchport mode access', 'switchport access vlan',
        'switchport nonegotiate', 'spanning-tree portfast',
        'spanning-tree bpduguard enable'
    ]
    correct_return_value = [
        'interface FastEthernet0/12', 'switchport mode access',
        'switchport access vlan 10', 'switchport nonegotiate',
        'spanning-tree portfast', 'spanning-tree bpduguard enable',
        'interface FastEthernet0/14', 'switchport mode access',
        'switchport access vlan 11', 'switchport nonegotiate',
        'spanning-tree portfast', 'spanning-tree bpduguard enable',
        'interface FastEthernet0/16', 'switchport mode access',
        'switchport access vlan 17', 'switchport nonegotiate',
        'spanning-tree portfast', 'spanning-tree bpduguard enable'
    ]

    return_value = task_9_1.generate_access_config(access_vlans_mapping,
                                                   template_access_mode)
    assert return_value != None, "none"
    assert type(return_value) == list, "list waiting"
    assert return_value == correct_return_value, "wrong return value"
示例#5
0
def test_function_return_value():
    """
    Проверка работы функции
    """
    access_vlans_mapping = {
        "FastEthernet0/12": 10,
        "FastEthernet0/14": 11,
        "FastEthernet0/16": 17,
    }
    template_access_mode = [
        "switchport mode access",
        "switchport access vlan",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
    ]
    correct_return_value = [
        "interface FastEthernet0/12",
        "switchport mode access",
        "switchport access vlan 10",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
        "interface FastEthernet0/14",
        "switchport mode access",
        "switchport access vlan 11",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
        "interface FastEthernet0/16",
        "switchport mode access",
        "switchport access vlan 17",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
    ]

    return_value = task_9_1.generate_access_config(
        access_vlans_mapping, template_access_mode
    )
    assert return_value != None, "Функция ничего не возвращает"
    assert (
        type(return_value) == list
    ), f"По заданию функция должна возвращать список, а возвращает {type(return_value).__name__}"
    assert (
        return_value == correct_return_value
    ), "Функция возвращает неправильное значение"
示例#6
0
def test_function_return_value():
    """
    Function check
    """
    access_vlans_mapping = {
        "FastEthernet0/12": 10,
        "FastEthernet0/14": 11,
        "FastEthernet0/16": 17,
    }
    template_access_mode = [
        "switchport mode access",
        "switchport access vlan",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
    ]
    correct_return_value = [
        "interface FastEthernet0/12",
        "switchport mode access",
        "switchport access vlan 10",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
        "interface FastEthernet0/14",
        "switchport mode access",
        "switchport access vlan 11",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
        "interface FastEthernet0/16",
        "switchport mode access",
        "switchport access vlan 17",
        "switchport nonegotiate",
        "spanning-tree portfast",
        "spanning-tree bpduguard enable",
    ]

    return_value = task_9_1.generate_access_config(access_vlans_mapping,
                                                   template_access_mode)
    assert return_value != None, "The function returns None"
    assert (
        type(return_value) == list
    ), f"The function should return a list, instead it returns a {type(return_value).__name__}"
    assert (
        return_value == correct_return_value), "Function returns wrong value"