Cleanup discovery & add tests (#212)

* Cleanup discovery & add tests

* discovered_devices_raw is not anymore available, as that can be accessed directly from the device objects
* test most of the discovery code paths
* some minor cleanups to test handling
* update discovery docs

* Move category check to be after the definitions

* skip a couple of tests requiring asyncmock not available on py37

* Remove return_raw usage from cli.discover
This commit is contained in:
Teemu R
2021-09-24 17:18:11 +02:00
committed by GitHub
parent bdb07a749c
commit acb221b1e0
4 changed files with 114 additions and 72 deletions

View File

@@ -143,13 +143,11 @@ async def discover(ctx, timeout, discover_only, dump_raw):
"""Discover devices in the network."""
target = ctx.parent.params["target"]
click.echo(f"Discovering devices on {target} for {timeout} seconds")
found_devs = await Discover.discover(
target=target, timeout=timeout, return_raw=dump_raw
)
found_devs = await Discover.discover(target=target, timeout=timeout)
if not discover_only:
for ip, dev in found_devs.items():
if dump_raw:
click.echo(dev)
click.echo(dev.sys_info)
continue
ctx.obj = dev
await ctx.invoke(state)