From 60080fb171b328c936acdfb19a2b982e340847b2 Mon Sep 17 00:00:00 2001 From: Aiden Baker Date: Thu, 25 Jul 2024 08:23:35 -0400 Subject: [PATCH] Added test --- tests/api2/test_005_interface.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/api2/test_005_interface.py b/tests/api2/test_005_interface.py index 9e27e3f19048d..72cd1f8bc8a7e 100644 --- a/tests/api2/test_005_interface.py +++ b/tests/api2/test_005_interface.py @@ -4,8 +4,10 @@ apifolder = os.getcwd() sys.path.append(apifolder) +import errno import pytest +from middlewared.service_exception import ValidationError, ValidationErrors from auto_config import interface, ha, netmask from middlewared.test.integration.utils.client import client, truenas_server from middlewared.test.integration.utils import call @@ -118,3 +120,14 @@ def test_002_configure_interface(request, ws_client, get_payload): def test_003_recheck_ipvx(request): assert int(call('tunable.get_sysctl', f'net.ipv6.conf.{interface}.autoconf')) == 0 + +def test_004_remove_critical_failover_group(request): + with pytest.raises(ValidationErrors) as ve: + call('interface.update', interface, {'failover_group': None, 'failover_critical': True}) + assert ve.value.errors == [ + ValidationError( + 'interface_update.failover_group', + 'A failover group is required when configuring a critical failover interface.', + errno.EAGAIN + ) + ]