From 1112bc266421527ea03bdb135b05f53b68aa5efb Mon Sep 17 00:00:00 2001 From: Wen Liang Date: Mon, 27 Sep 2021 07:05:06 -0400 Subject: [PATCH] refactor IPv6 DNS test when IPv6 is disabled Signed-off-by: Wen Liang --- tests/unit/test_network_connections.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_network_connections.py b/tests/unit/test_network_connections.py index 3537264..22f8f1f 100644 --- a/tests/unit/test_network_connections.py +++ b/tests/unit/test_network_connections.py @@ -3626,12 +3626,12 @@ class TestValidator(unittest.TestCase): 0, ) - def test_ipv6_dns_without_ipv6_config(self): + def test_ipv6_dns_with_ipv6_disabled(self): """ Test that configuring IPv6 DNS is not allowed when IPv6 is disabled. """ validator = network_lsr.argument_validator.ArgValidator_ListConnections() - ipv6_dns_without_ipv6_config = [ + ipv6_dns_with_ipv6_disabled = [ { "name": "test_ipv6_dns", "type": "ethernet", @@ -3642,11 +3642,12 @@ class TestValidator(unittest.TestCase): }, } ] - self.assertRaises( + self.assertRaisesRegexp( ValidationError, + "IPv6 needs to be enabled to support IPv6 nameservers.", validator.validate_connection_one, "nm", - validator.validate(ipv6_dns_without_ipv6_config), + validator.validate(ipv6_dns_with_ipv6_disabled), 0, )