Verified Commit 958469ed authored by Filip Hron's avatar Filip Hron
Browse files

add tests

parent 78bfff44
Pipeline #76802 passed with stage
in 10 minutes and 12 seconds
......@@ -220,6 +220,7 @@ def test_update_settings_openwrt(
assert uci.get_option_named(data, "network", "guest_turris", "ipaddr") == "192.168.8.1"
assert uci.get_option_named(data, "network", "guest_turris", "netmask") == "255.255.255.0"
assert uci.parse_bool(uci.get_option_named(data, "network", "guest_turris", "bridge_empty"))
assert uci.get_option_named(data, "network", "guest_turris","ip6assign") == "64"
assert uci.parse_bool(uci.get_option_named(data, "dhcp", "guest_turris", "ignore"))
assert uci.get_option_named(data, "dhcp", "guest_turris", "interface") == "guest_turris"
......@@ -253,6 +254,36 @@ def test_update_settings_openwrt(
assert uci.get_option_named(data, "firewall", "guest_turris_dhcp_rule", "dest_port") == "67-68"
assert uci.get_option_named(data, "firewall", "guest_turris_dhcp_rule", "target") == "ACCEPT"
# ipv6 dhcp
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "src") == "guest_turris"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "proto") == "udp"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "src_ip") == "fe80::/10"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "src_port") == "546-547"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "dest_ip") == "fe80::/10"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "dest_port") == "546-547"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "family") == "ipv6"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_DHCPv6", "target") == "ACCEPT"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_MLD", "src") == "guest_turris"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_MLD", "proto") == "icmp"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_MLD", "src_ip") == "fe80::/10"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_MLD", "family") == "ipv6"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_MLD", "target") == "ACCEPT"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_MLD", "icmp_type") == [
'130/0', '131/0', '132/0', '143/0'
]
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_ICMPv6_Input", "src") == "guest_turris"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_ICMPv6_Input", "proto") == "icmp"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_ICMPv6_Input", "limit") == "1000/sec"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_ICMPv6_Input", "family") == "ipv6"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_ICMPv6_Input", "target") == "ACCEPT"
assert uci.get_option_named(data, "firewall", "guest_turris_Allow_ICMPv6_Input", "icmp_type") == [
'echo-request', 'echo-reply', 'destination-unreachable', 'packet-too-big', 'time-exceeded',
'bad-header', 'unknown-header-type', 'router-solicitation', 'neighbour-solicitation',
'router-advertisement', 'neighbour-advertisement'
]
with pytest.raises(UciRecordNotFound):
assert uci.get_option_named(data, "sqm", "guest_limit_turris", "enabled")
......@@ -297,6 +328,8 @@ def test_update_settings_openwrt(
assert uci.get_option_named(data, "dhcp", "guest_turris", "limit") == "100"
assert uci.get_option_named(data, "dhcp", "guest_turris", "leasetime") == "201"
assert uci.get_option_named(data, "dhcp", "guest_turris", "dhcp_option") == ["6,192.168.11.1"]
assert uci.get_option_named(data, "dhcp", "guest_turris", "dhcpv6") == "server"
assert uci.get_option_named(data, "dhcp", "guest_turris", "ra") == "server"
# test guest disabled
update({"enabled": False})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment