From 2dc893044a479387492da8bd6c6745faa013e55f Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 09:56:53 +0200 Subject: [PATCH 01/11] Add fixtures --- tests/unittests/portadmin/portadmin_test.py | 53 +++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index 024d22c357..fed1e84480 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -1,6 +1,7 @@ from mock import Mock import unittest +import pytest from nav.oids import OID from nav.enterprise.ids import VENDOR_ID_HEWLETT_PACKARD, VENDOR_ID_CISCOSYSTEMS @@ -148,5 +149,57 @@ def test_get_ifaliases_cisco(self): ) +@pytest.fixture +def profile(): + profile = Mock() + profile.snmp_version = 2 + profile.snmp_community = "public" + return profile + + +@pytest.fixture +def netbox_hp(profile): + vendor = Mock() + vendor.id = u'hp' + + netbox_type = Mock() + netbox_type.vendor = vendor + netbox_type.get_enterprise_id.return_value = VENDOR_ID_HEWLETT_PACKARD + + netbox = Mock() + netbox.type = netbox_type + netbox.ip = '10.240.160.39' + netbox.get_preferred_snmp_management_profile.return_value = profile + + return netbox + + +@pytest.fixture +def netbox_cisco(profile): + vendor = Mock() + vendor.id = u'cisco' + + netbox_type = Mock() + netbox_type.vendor = vendor + netbox_type.get_enterprise_id.return_value = VENDOR_ID_CISCOSYSTEMS + + netbox = Mock() + netbox.type = netbox_type + netbox.ip = '10.240.160.38' + netbox.get_preferred_snmp_management_profile.return_value = profile + + return netbox + + +@pytest.fixture +def handler_hp(netbox_hp): + return ManagementFactory.get_instance(netbox_hp) + + +@pytest.fixture +def handler_cisco(netbox_cisco): + return ManagementFactory.get_instance(netbox_cisco) + + if __name__ == '__main__': unittest.main() From 716ab4d6b84bf6c69df2b0432032ac119fcdf651 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 10:16:00 +0200 Subject: [PATCH 02/11] Use pytest fixtures instead of unittest for tests --- tests/unittests/portadmin/portadmin_test.py | 141 +++++--------------- 1 file changed, 34 insertions(+), 107 deletions(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index fed1e84480..dfc5492cd4 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -1,6 +1,5 @@ from mock import Mock -import unittest import pytest from nav.oids import OID @@ -11,142 +10,74 @@ from nav.portadmin.vlan import FantasyVlan -class PortadminResponseTest(unittest.TestCase): - def setUp(self): - self.profile = Mock() - self.profile.snmp_version = 2 - self.profile.snmp_community = "public" - - self.hpVendor = Mock() - self.hpVendor.id = u'hp' - - self.ciscoVendor = Mock() - self.ciscoVendor.id = u'cisco' - - self.hpType = Mock() - self.hpType.vendor = self.hpVendor - self.hpType.get_enterprise_id.return_value = VENDOR_ID_HEWLETT_PACKARD - - self.ciscoType = Mock() - self.ciscoType.vendor = self.ciscoVendor - self.ciscoType.get_enterprise_id.return_value = VENDOR_ID_CISCOSYSTEMS - - self.netboxHP = Mock() - self.netboxHP.type = self.hpType - self.netboxHP.ip = '10.240.160.39' - self.netboxHP.get_preferred_snmp_management_profile.return_value = self.profile - - self.netboxCisco = Mock() - self.netboxCisco.type = self.ciscoType - self.netboxCisco.ip = '10.240.160.38' - self.netboxCisco.get_preferred_snmp_management_profile.return_value = ( - self.profile - ) - - self.snmpReadOnlyHandler = None - self.handler = None - - def tearDown(self): - self.hpVendor = None - self.ciscoVendor = None - self.hpType = None - self.ciscoType = None - self.netboxHP = None - self.netboxCisco = None - self.handler = None - self.snmpReadOnlyHandler = None - self.snmpReadWriteHandler = None - +class TestPortadminResponse: #################################################################### # HP-netbox + def test_management_factory_get_hp(self, handler_hp): + assert handler_hp != None, "Could not get handler-object" + assert isinstance(handler_hp, HP), "Wrong handler-type" - def test_management_factory_get_hp(self): - self.handler = ManagementFactory.get_instance(self.netboxHP) - self.assertNotEqual(self.handler, None, 'Could not get handler-object') - self.assertIsInstance(self.handler, HP, msg='Wrong handler-type') - - def test_get_vlan_hp(self): - self.handler = ManagementFactory.get_instance(self.netboxHP) + def test_get_vlan_hp(self, handler_hp): # get hold of the read-only Snmp-object - self.snmpReadOnlyHandler = self.handler._get_read_only_handle() + snmpReadOnlyHandler = handler_hp._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # this get-method returns a vlan-number - self.snmpReadOnlyHandler.get = Mock(return_value=666) + snmpReadOnlyHandler.get = Mock(return_value=666) ifc = Mock(baseport=1) - self.assertEqual( - self.handler.get_interface_native_vlan(ifc), 666, "getVlan-test failed" - ) - self.snmpReadOnlyHandler.get.assert_called_with( - OID('.1.3.6.1.2.1.17.7.1.4.5.1.1.1') - ) - - def test_get_ifaliases_hp(self): - self.handler = ManagementFactory.get_instance(self.netboxHP) + assert handler_hp.get_interface_native_vlan(ifc) == 666, "getVlan-test failed" + snmpReadOnlyHandler.get.assert_called_with(OID('.1.3.6.1.2.1.17.7.1.4.5.1.1.1')) + + def test_get_ifaliases_hp(self, handler_hp): # get hold of the read-only Snmp-object - self.snmpReadOnlyHandler = self.handler._get_read_only_handle() + snmpReadOnlyHandler = handler_hp._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # for getting all IfAlias walkdata = [('.1', b'hjalmar'), ('.2', b'snorre'), ('.3', b'bjarne')] expected = {1: 'hjalmar', 2: 'snorre', 3: 'bjarne'} - self.snmpReadOnlyHandler.bulkwalk = Mock(return_value=walkdata) - self.assertEqual( - self.handler._get_all_ifaliases(), expected, "getAllIfAlias failed." - ) + snmpReadOnlyHandler.bulkwalk = Mock(return_value=walkdata) + assert handler_hp._get_all_ifaliases() == expected, "getAllIfAlias failed." - def test_set_ifalias_hp(self): - self.handler = ManagementFactory.get_instance(self.netboxHP) + def test_set_ifalias_hp(self, handler_hp): # get hold of the read-write Snmp-object - self.snmpReadWriteHandler = self.handler._get_read_write_handle() - + snmpReadWriteHandler = handler_hp._get_read_write_handle() # replace set-method on Snmp-object with a mock-method # all set-methods return None - self.snmpReadWriteHandler.set = Mock(return_value=None) + snmpReadWriteHandler.set = Mock(return_value=None) interface = Mock() interface.ifindex = 1 - self.assertEqual( - self.handler.set_interface_description(interface, "punkt1"), - None, - "setIfAlias failed", - ) + assert ( + handler_hp.set_interface_description(interface, "punkt1") == None + ), "setIfAlias failed" #################################################################### # CISCO-netbox - def test_management_factory_get_cisco(self): + def test_management_factory_get_cisco(self, handler_cisco): #################################################################### # cisco-netbox - self.handler = ManagementFactory.get_instance(self.netboxCisco) - self.assertNotEqual(self.handler, None, 'Could not get handler-object') - self.assertIsInstance(self.handler, Cisco, 'Wrong handler-type') + assert handler_cisco != None, "Could not get handler-object" + assert isinstance(handler_cisco, Cisco), "Wrong handler-type" - def test_get_vlan_cisco(self): - self.handler = ManagementFactory.get_instance(self.netboxCisco) - assert type(self.handler) == Cisco + def test_get_vlan_cisco(self, handler_cisco): + assert type(handler_cisco) == Cisco # get hold of the read-only Snmp-object - self.snmpReadOnlyHandler = self.handler._get_read_only_handle() + snmpReadOnlyHandler = handler_cisco._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # this get-method returns a vlan-number - self.snmpReadOnlyHandler.get = Mock(return_value=77) + snmpReadOnlyHandler.get = Mock(return_value=77) ifc = Mock(ifindex=1) - self.assertEqual( - self.handler.get_interface_native_vlan(ifc), 77, "getVlan-test failed" - ) - self.snmpReadOnlyHandler.get.assert_called_with( - '1.3.6.1.4.1.9.9.68.1.2.2.1.2.1' - ) - - def test_get_ifaliases_cisco(self): - self.handler = ManagementFactory.get_instance(self.netboxCisco) + assert handler_cisco.get_interface_native_vlan(ifc) == 77, "getVlan-test failed" + snmpReadOnlyHandler.get.assert_called_with('1.3.6.1.4.1.9.9.68.1.2.2.1.2.1') + + def test_get_ifaliases_cisco(self, handler_cisco): # get hold of the read-only Snmp-object - self.snmpReadOnlyHandler = self.handler._get_read_only_handle() + snmpReadOnlyHandler = handler_cisco._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # for getting all IfAlias walkdata = [('.1', b'jomar'), ('.2', b'knut'), ('.3', b'hjallis')] expected = {1: 'jomar', 2: 'knut', 3: 'hjallis'} - self.snmpReadOnlyHandler.bulkwalk = Mock(return_value=walkdata) - self.assertEqual( - self.handler._get_all_ifaliases(), expected, "getAllIfAlias failed." - ) + snmpReadOnlyHandler.bulkwalk = Mock(return_value=walkdata) + assert handler_cisco._get_all_ifaliases() == expected, "getAllIfAlias failed." @pytest.fixture @@ -199,7 +130,3 @@ def handler_hp(netbox_hp): @pytest.fixture def handler_cisco(netbox_cisco): return ManagementFactory.get_instance(netbox_cisco) - - -if __name__ == '__main__': - unittest.main() From c4fd5876038dd38c0a64de59cc0450317e30f13d Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 11:19:03 +0200 Subject: [PATCH 03/11] Remove unused import --- tests/unittests/portadmin/portadmin_test.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index dfc5492cd4..16f623d61d 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -6,9 +6,6 @@ from nav.enterprise.ids import VENDOR_ID_HEWLETT_PACKARD, VENDOR_ID_CISCOSYSTEMS from nav.portadmin.management import * -############################################################################### -from nav.portadmin.vlan import FantasyVlan - class TestPortadminResponse: #################################################################### From 47653a3fa54b9d9c55b8075a6deea6f8a2124102 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 11:20:06 +0200 Subject: [PATCH 04/11] Import only what the module actually uses --- tests/unittests/portadmin/portadmin_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index 16f623d61d..88a501a5c1 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -4,7 +4,7 @@ from nav.oids import OID from nav.enterprise.ids import VENDOR_ID_HEWLETT_PACKARD, VENDOR_ID_CISCOSYSTEMS -from nav.portadmin.management import * +from nav.portadmin.management import ManagementFactory, HP, Cisco class TestPortadminResponse: From e1b8dbdd7198dda5196e0b7e46507a49e563ba4e Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 11:21:52 +0200 Subject: [PATCH 05/11] Separate hp and cisco tests --- tests/unittests/portadmin/portadmin_test.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index 88a501a5c1..d53cbfa2dd 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -7,9 +7,7 @@ from nav.portadmin.management import ManagementFactory, HP, Cisco -class TestPortadminResponse: - #################################################################### - # HP-netbox +class TestPortadminResponseHP: def test_management_factory_get_hp(self, handler_hp): assert handler_hp != None, "Could not get handler-object" assert isinstance(handler_hp, HP), "Wrong handler-type" @@ -46,12 +44,9 @@ def test_set_ifalias_hp(self, handler_hp): handler_hp.set_interface_description(interface, "punkt1") == None ), "setIfAlias failed" - #################################################################### - # CISCO-netbox +class TestPortadminResponseCisco: def test_management_factory_get_cisco(self, handler_cisco): - #################################################################### - # cisco-netbox assert handler_cisco != None, "Could not get handler-object" assert isinstance(handler_cisco, Cisco), "Wrong handler-type" From 45c500a94f2dce863c87c57149c4f0617335c021 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 11:23:48 +0200 Subject: [PATCH 06/11] Remove something that is tested in other test --- tests/unittests/portadmin/portadmin_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index d53cbfa2dd..c6d6720555 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -51,7 +51,6 @@ def test_management_factory_get_cisco(self, handler_cisco): assert isinstance(handler_cisco, Cisco), "Wrong handler-type" def test_get_vlan_cisco(self, handler_cisco): - assert type(handler_cisco) == Cisco # get hold of the read-only Snmp-object snmpReadOnlyHandler = handler_cisco._get_read_only_handle() # replace get-method on Snmp-object with a mock-method From a2e3a8e9aa3a1c4491f4ec601857741e2b3d62c2 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 11:44:53 +0200 Subject: [PATCH 07/11] Put factory tests in separate class --- tests/unittests/portadmin/portadmin_test.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index c6d6720555..b246079902 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -7,11 +7,19 @@ from nav.portadmin.management import ManagementFactory, HP, Cisco -class TestPortadminResponseHP: - def test_management_factory_get_hp(self, handler_hp): - assert handler_hp != None, "Could not get handler-object" - assert isinstance(handler_hp, HP), "Wrong handler-type" +class TestPortadminManagementFactory: + def test_get_hp(self, netbox_hp): + handler = ManagementFactory.get_instance(netbox_hp) + assert handler != None, "Could not get handler-object" + assert isinstance(handler, HP), "Wrong handler-type" + + def test_get_cisco(self, netbox_cisco): + handler = ManagementFactory.get_instance(netbox_cisco) + assert handler != None, "Could not get handler-object" + assert isinstance(handler, Cisco), "Wrong handler-type" + +class TestPortadminResponseHP: def test_get_vlan_hp(self, handler_hp): # get hold of the read-only Snmp-object snmpReadOnlyHandler = handler_hp._get_read_only_handle() @@ -46,10 +54,6 @@ def test_set_ifalias_hp(self, handler_hp): class TestPortadminResponseCisco: - def test_management_factory_get_cisco(self, handler_cisco): - assert handler_cisco != None, "Could not get handler-object" - assert isinstance(handler_cisco, Cisco), "Wrong handler-type" - def test_get_vlan_cisco(self, handler_cisco): # get hold of the read-only Snmp-object snmpReadOnlyHandler = handler_cisco._get_read_only_handle() From 522a6b5087a70ab5a6b1477634178ee04f4732fa Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 11:47:35 +0200 Subject: [PATCH 08/11] Import vendor handlers directly --- tests/unittests/portadmin/portadmin_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index b246079902..e79b39a78f 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -4,7 +4,9 @@ from nav.oids import OID from nav.enterprise.ids import VENDOR_ID_HEWLETT_PACKARD, VENDOR_ID_CISCOSYSTEMS -from nav.portadmin.management import ManagementFactory, HP, Cisco +from nav.portadmin.management import ManagementFactory +from nav.portadmin.snmp.hp import HP +from nav.portadmin.snmp.cisco import Cisco class TestPortadminManagementFactory: From d4e065d6bcf1038187e7d9e5bc0a65aa62c916cf Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 12:29:39 +0200 Subject: [PATCH 09/11] Use 'is not' for comparing against None --- tests/unittests/portadmin/portadmin_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index e79b39a78f..3a88c13de1 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -12,12 +12,12 @@ class TestPortadminManagementFactory: def test_get_hp(self, netbox_hp): handler = ManagementFactory.get_instance(netbox_hp) - assert handler != None, "Could not get handler-object" + assert handler is not None, "Could not get handler-object" assert isinstance(handler, HP), "Wrong handler-type" def test_get_cisco(self, netbox_cisco): handler = ManagementFactory.get_instance(netbox_cisco) - assert handler != None, "Could not get handler-object" + assert handler is not None, "Could not get handler-object" assert isinstance(handler, Cisco), "Wrong handler-type" From 1e54014dd674769408703a5ff2368e31b9c78fe8 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 12:31:13 +0200 Subject: [PATCH 10/11] Replace camel-case --- tests/unittests/portadmin/portadmin_test.py | 26 +++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index 3a88c13de1..406e8ef00e 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -24,30 +24,32 @@ def test_get_cisco(self, netbox_cisco): class TestPortadminResponseHP: def test_get_vlan_hp(self, handler_hp): # get hold of the read-only Snmp-object - snmpReadOnlyHandler = handler_hp._get_read_only_handle() + snmp_read_only_handler = handler_hp._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # this get-method returns a vlan-number - snmpReadOnlyHandler.get = Mock(return_value=666) + snmp_read_only_handler.get = Mock(return_value=666) ifc = Mock(baseport=1) assert handler_hp.get_interface_native_vlan(ifc) == 666, "getVlan-test failed" - snmpReadOnlyHandler.get.assert_called_with(OID('.1.3.6.1.2.1.17.7.1.4.5.1.1.1')) + snmp_read_only_handler.get.assert_called_with( + OID('.1.3.6.1.2.1.17.7.1.4.5.1.1.1') + ) def test_get_ifaliases_hp(self, handler_hp): # get hold of the read-only Snmp-object - snmpReadOnlyHandler = handler_hp._get_read_only_handle() + snmp_read_only_handler = handler_hp._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # for getting all IfAlias walkdata = [('.1', b'hjalmar'), ('.2', b'snorre'), ('.3', b'bjarne')] expected = {1: 'hjalmar', 2: 'snorre', 3: 'bjarne'} - snmpReadOnlyHandler.bulkwalk = Mock(return_value=walkdata) + snmp_read_only_handler.bulkwalk = Mock(return_value=walkdata) assert handler_hp._get_all_ifaliases() == expected, "getAllIfAlias failed." def test_set_ifalias_hp(self, handler_hp): # get hold of the read-write Snmp-object - snmpReadWriteHandler = handler_hp._get_read_write_handle() + snmp_read_only_handler = handler_hp._get_read_write_handle() # replace set-method on Snmp-object with a mock-method # all set-methods return None - snmpReadWriteHandler.set = Mock(return_value=None) + snmp_read_only_handler.set = Mock(return_value=None) interface = Mock() interface.ifindex = 1 assert ( @@ -58,22 +60,22 @@ def test_set_ifalias_hp(self, handler_hp): class TestPortadminResponseCisco: def test_get_vlan_cisco(self, handler_cisco): # get hold of the read-only Snmp-object - snmpReadOnlyHandler = handler_cisco._get_read_only_handle() + snmp_read_only_handler = handler_cisco._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # this get-method returns a vlan-number - snmpReadOnlyHandler.get = Mock(return_value=77) + snmp_read_only_handler.get = Mock(return_value=77) ifc = Mock(ifindex=1) assert handler_cisco.get_interface_native_vlan(ifc) == 77, "getVlan-test failed" - snmpReadOnlyHandler.get.assert_called_with('1.3.6.1.4.1.9.9.68.1.2.2.1.2.1') + snmp_read_only_handler.get.assert_called_with('1.3.6.1.4.1.9.9.68.1.2.2.1.2.1') def test_get_ifaliases_cisco(self, handler_cisco): # get hold of the read-only Snmp-object - snmpReadOnlyHandler = handler_cisco._get_read_only_handle() + snmp_read_only_handler = handler_cisco._get_read_only_handle() # replace get-method on Snmp-object with a mock-method # for getting all IfAlias walkdata = [('.1', b'jomar'), ('.2', b'knut'), ('.3', b'hjallis')] expected = {1: 'jomar', 2: 'knut', 3: 'hjallis'} - snmpReadOnlyHandler.bulkwalk = Mock(return_value=walkdata) + snmp_read_only_handler.bulkwalk = Mock(return_value=walkdata) assert handler_cisco._get_all_ifaliases() == expected, "getAllIfAlias failed." From 552c7b90132d2767cee0970baa7bc66bb707df95 Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Wed, 30 Aug 2023 12:34:45 +0200 Subject: [PATCH 11/11] Compare against None using 'is' instead of '==' --- tests/unittests/portadmin/portadmin_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/portadmin/portadmin_test.py b/tests/unittests/portadmin/portadmin_test.py index 406e8ef00e..b25cb20be2 100644 --- a/tests/unittests/portadmin/portadmin_test.py +++ b/tests/unittests/portadmin/portadmin_test.py @@ -53,7 +53,7 @@ def test_set_ifalias_hp(self, handler_hp): interface = Mock() interface.ifindex = 1 assert ( - handler_hp.set_interface_description(interface, "punkt1") == None + handler_hp.set_interface_description(interface, "punkt1") is None ), "setIfAlias failed"