From: Aleš Mrázek Date: Tue, 8 Aug 2023 08:21:56 +0000 (+0200) Subject: tests: datamodel: types: 'IPAddressEM' validation X-Git-Tag: v6.0.2~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6b213d3f2707d1519e4b0e87baca2e6d6db7a20;p=thirdparty%2Fknot-resolver.git tests: datamodel: types: 'IPAddressEM' validation --- diff --git a/manager/tests/unit/datamodel/types/test_custom_types.py b/manager/tests/unit/datamodel/types/test_custom_types.py index ac95b79cf..5eebef3a0 100644 --- a/manager/tests/unit/datamodel/types/test_custom_types.py +++ b/manager/tests/unit/datamodel/types/test_custom_types.py @@ -13,6 +13,7 @@ from knot_resolver_manager.datamodel.types import ( InterfaceName, InterfaceOptionalPort, InterfacePort, + IPAddressEM, IPAddressOptionalPort, IPAddressPort, IPNetwork, @@ -305,3 +306,14 @@ def test_ipv6_96_network_valid(val: str): def test_ipv6_96_network_invalid(val: Any): with raises(ValueError): IPv6Network96(val) + + +@pytest.mark.parametrize("val", ["10.10.10.5!", "::1!"]) +def test_ip_address_em_valid(val: str): + assert str(IPAddressEM(val)) == val + + +@pytest.mark.parametrize("val", ["10.10.10.5", "::1", "10.10.10.5!!", "::1!!"]) +def test_ip_address_em_invalid(val: Any): + with raises(ValueError): + IPAddressEM(val)