mirror of
https://github.com/Horizontal42/netsleuth.git
synced 2026-11-11 01:02:10 +03:00
🧪 Add missing error path test for resolve_bind_target with unroutable IP
Adds a test to cover the branch in `resolve_bind_target` where an explicit error is returned if `iface_for_ip` returns `None` for a valid IP. This covers an otherwise untested error path, bringing branch coverage to 100% for this code block. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
parent
8c99ac78b7
commit
12644bb362
1 changed files with 10 additions and 0 deletions
|
|
@ -61,6 +61,16 @@ def test_resolve_bind_target_by_exact_name():
|
|||
assert result.error is None
|
||||
|
||||
|
||||
def test_resolve_bind_target_by_unmapped_ip_is_an_error():
|
||||
result = resolve_bind_target(
|
||||
"10.255.255.255",
|
||||
addrs(Ethernet=[(socket.AF_INET, "192.168.3.72")]),
|
||||
up(Ethernet=True),
|
||||
)
|
||||
assert result.error is not None
|
||||
assert result.error == "no adapter has the address '10.255.255.255'"
|
||||
|
||||
|
||||
def test_resolve_bind_target_by_ip_finds_owning_adapter():
|
||||
result = resolve_bind_target(
|
||||
"192.168.3.72",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue