def test_to_list_failure(): with pytest.raises(ValueError, match=r"Valid VLAN range*"): vlan.vlanconfig_to_list( "switchport trunk allowed vlan 1025,1069-1072,4099") with pytest.raises(ValueError, match=r"There were non-digits and dashes*"): vlan.vlanconfig_to_list( "switchport trunk allowed vlan 1025,1069-1072,BADDATA")
def test_to_list_success(_file, get_text_data, get_json_data): truncate_file = os.path.join(MOCK_DIR, _file[:-len(TXT_FILE)]) sent_data = get_text_data(os.path.join(MOCK_DIR, _file)) received_data = get_json_data(truncate_file + "_received.json") assert vlan.vlanconfig_to_list(sent_data) == received_data