From a9e964012d89a3e1b34ff45f63a8b42d5a0cf48c Mon Sep 17 00:00:00 2001 From: kent paik Date: Thu, 9 Oct 2025 03:34:14 +0900 Subject: [PATCH] test: Remove unnecessary 'or []' fallback in assertions - Remove defensive 'or []' checks when fixed_ips is never None - Add explicit validation for bulk operation results - Related to #77 investigation (no call_count issues found) --- tests/tools/test_network_tools.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_network_tools.py b/tests/tools/test_network_tools.py index c41f2e3..b3b6d8b 100644 --- a/tests/tools/test_network_tools.py +++ b/tests/tools/test_network_tools.py @@ -676,7 +676,7 @@ def test_add_port_fixed_ip(self, mock_openstack_connect_network): new_fixed = list(current.fixed_ips) new_fixed.append({"subnet_id": "subnet-2", "ip_address": "10.0.1.10"}) res = tools.update_port("port-1", fixed_ips=new_fixed) - assert len(res.fixed_ips or []) == 2 + assert len(res.fixed_ips) == 2 def test_remove_port_fixed_ip(self, mock_openstack_connect_network): mock_conn = mock_openstack_connect_network @@ -711,7 +711,7 @@ def test_remove_port_fixed_ip(self, mock_openstack_connect_network): fi for fi in current.fixed_ips if fi["ip_address"] != "10.0.1.10" ] res = tools.update_port("port-1", fixed_ips=filtered) - assert len(res.fixed_ips or []) == 1 + assert len(res.fixed_ips) == 1 def test_get_and_update_allowed_address_pairs( self, @@ -1289,6 +1289,7 @@ def test_update_reassign_bulk_and_auto_assign_floating_ip( mock_conn.network.create_ip.side_effect = [f1] bulk = tools.create_floating_ips_bulk("ext-net", 1) assert len(bulk) == 1 + assert bulk[0].id == f1.id exists = Mock() exists.id = "fip-b"