Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Apr 2, 2024
1 parent aec9035 commit 92d91ec
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/unittests/net/test_dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,13 +1202,6 @@ def test_parse_lease_dump(self):
@pytest.mark.parametrize(
"lease, parsed",
(
pytest.param(
"""
fail
""",
{},
id="lease_has_no_keys",
),
pytest.param(
"""
Expand Down Expand Up @@ -1250,6 +1243,7 @@ def test_parse_lease_dump_resilience(self, lease, parsed):
with mock.patch("cloudinit.net.dhcp.util.load_binary_file"):
Dhcpcd.parse_dhcpcd_lease(dedent(lease), "eth0")


def test_parse_lease_dump_fails(self):
def _raise():
raise ValueError()
Expand All @@ -1261,6 +1255,15 @@ def _raise():
with mock.patch("cloudinit.net.dhcp.util.load_binary_file"):
Dhcpcd.parse_dhcpcd_lease(lease, "eth0")

with pytest.raises(InvalidDHCPLeaseFileError):
with mock.patch("cloudinit.net.dhcp.util.load_binary_file"):
lease = dedent(
"""
fail
"""
)
Dhcpcd.parse_dhcpcd_lease(lease, "eth0")

@pytest.mark.parametrize(
"lease_file, option_245",
(
Expand Down

0 comments on commit 92d91ec

Please sign in to comment.