def test_interface_forward_no_comment(location, system_context):
    ipt.install_rules(location, system_context)

    ipt.forward_interface(system_context, 've-testiface')

    _validate_rules_files(
        system_context, '-A FORWARD -i ve-testiface -j ACCEPT',
        '-A FORWARD -o ve-testiface -m conntrack '
        '--ctstate RELATED,ESTABLISHED -j ACCEPT')
def test_interface_forward(location, system_context):
    ipt.install_rules(location, system_context)

    ipt.forward_interface(system_context, "ve-testiface", comment="test iface")

    _validate_rules_files(
        system_context,
        "# test iface:",
        "-A FORWARD -i ve-testiface -j ACCEPT",
        "-A FORWARD -o ve-testiface -m conntrack "
        "--ctstate RELATED,ESTABLISHED -j ACCEPT",
    )
def test_interface_no_double_entries(location, system_context):
    ipt.install_rules(location, system_context)

    ipt.forward_interface(system_context, "ve-testiface", comment="test iface")
    with pytest.raises(GenerateError):
        ipt.forward_interface(system_context, "ve-testiface")