Skip to content

Commit 7f87639

Browse files
paikendhalucinor
authored andcommitted
test: Remove unnecessary 'or []' fallback in assertions (#80)
- 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 8407ea4 commit 7f87639

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
@@ -738,7 +738,7 @@ def test_add_port_fixed_ip(self, mock_openstack_connect_network):
738738
new_fixed = list(current.fixed_ips)
739739
new_fixed.append({"subnet_id": "subnet-2", "ip_address": "10.0.1.10"})
740740
res = tools.update_port("port-1", fixed_ips=new_fixed)
741-
assert len(res.fixed_ips or []) == 2
741+
assert len(res.fixed_ips) == 2
742742

743743
def test_remove_port_fixed_ip(self, mock_openstack_connect_network):
744744
mock_conn = mock_openstack_connect_network
@@ -773,7 +773,7 @@ def test_remove_port_fixed_ip(self, mock_openstack_connect_network):
773773
fi for fi in current.fixed_ips if fi["ip_address"] != "10.0.1.10"
774774
]
775775
res = tools.update_port("port-1", fixed_ips=filtered)
776-
assert len(res.fixed_ips or []) == 1
776+
assert len(res.fixed_ips) == 1
777777

778778
def test_get_and_update_allowed_address_pairs(
779779
self,
@@ -1349,6 +1349,7 @@ def test_update_reassign_bulk_and_auto_assign_floating_ip(
13491349
mock_conn.network.create_ip.side_effect = [f1]
13501350
bulk = tools.create_floating_ips_bulk("ext-net", 1)
13511351
assert len(bulk) == 1
1352+
assert bulk[0].id == f1.id
13521353

13531354
exists = Mock()
13541355
exists.id = "fip-b"

0 commit comments

Comments
 (0)