Skip to content

Commit a9e9640

Browse files
committed
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)
1 parent fa77a53 commit a9e9640

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/tools/test_network_tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def test_add_port_fixed_ip(self, mock_openstack_connect_network):
676676
new_fixed = list(current.fixed_ips)
677677
new_fixed.append({"subnet_id": "subnet-2", "ip_address": "10.0.1.10"})
678678
res = tools.update_port("port-1", fixed_ips=new_fixed)
679-
assert len(res.fixed_ips or []) == 2
679+
assert len(res.fixed_ips) == 2
680680

681681
def test_remove_port_fixed_ip(self, mock_openstack_connect_network):
682682
mock_conn = mock_openstack_connect_network
@@ -711,7 +711,7 @@ def test_remove_port_fixed_ip(self, mock_openstack_connect_network):
711711
fi for fi in current.fixed_ips if fi["ip_address"] != "10.0.1.10"
712712
]
713713
res = tools.update_port("port-1", fixed_ips=filtered)
714-
assert len(res.fixed_ips or []) == 1
714+
assert len(res.fixed_ips) == 1
715715

716716
def test_get_and_update_allowed_address_pairs(
717717
self,
@@ -1289,6 +1289,7 @@ def test_update_reassign_bulk_and_auto_assign_floating_ip(
12891289
mock_conn.network.create_ip.side_effect = [f1]
12901290
bulk = tools.create_floating_ips_bulk("ext-net", 1)
12911291
assert len(bulk) == 1
1292+
assert bulk[0].id == f1.id
12921293

12931294
exists = Mock()
12941295
exists.id = "fip-b"

0 commit comments

Comments
 (0)