withasyncio_patch("gns3server.compute.qemu.subprocess_check_output",return_value="qemu-img version 2.2.0, Copyright (c) 2004-2008 Fabrice Bellard") as mock:
qemus = await Qemu.img_binary_list()
version = "2.2.0"
assert {"path": os.path.join(os.environ["PATH"], "qemu-img"), "version": version} in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-io"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-kvm"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": version} not in qemus
assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": version} not in qemus
# with asyncio_patch("gns3server.compute.qemu.subprocess_check_output", return_value="qemu-img version 2.2.0, Copyright (c) 2004-2008 Fabrice Bellard") as mock:
# qemus = await Qemu.img_binary_list()
#
# version = "2.2.0"
#
# assert {"path": os.path.join(os.environ["PATH"], "qemu-img"), "version": version} in qemus
# assert {"path": os.path.join(os.environ["PATH"], "qemu-io"), "version": version} not in qemus
# assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x86"), "version": version} not in qemus
# assert {"path": os.path.join(os.environ["PATH"], "qemu-kvm"), "version": version} not in qemus
# assert {"path": os.path.join(os.environ["PATH"], "qemu-system-x42"), "version": version} not in qemus
# assert {"path": os.path.join(os.environ["PATH"], "hello"), "version": version} not in qemus