Skip to content

Commit

Permalink
chore: add param for enable/disable tests (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli74 authored Oct 11, 2023
1 parent 0fb87da commit b81c324
Showing 1 changed file with 26 additions and 17 deletions.
43 changes: 26 additions & 17 deletions library_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test script for aiocomelit library."""
import argparse
import ast
import asyncio
import logging

Expand Down Expand Up @@ -60,6 +61,13 @@ def get_arguments() -> tuple[argparse.ArgumentParser, argparse.Namespace]:
default="",
help="Set VEDO system pin",
)
parser.add_argument(
"--test",
"-t",
type=ast.literal_eval,
default=True,
help="Execute test actions",
)
arguments = parser.parse_args()

return parser, arguments
Expand Down Expand Up @@ -99,23 +107,24 @@ async def main() -> None:
devices = await bridge_api.get_all_devices()
print("Devices:", devices)
print("-" * 20)
for device in devices[LIGHT].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, LIGHT)
break
for device in devices[COVER].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, COVER)
break
for device in devices[IRRIGATION].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, IRRIGATION)
break
for device in devices[OTHER].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, OTHER)
break
print("-" * 20)
if args.test:
for device in devices[LIGHT].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, LIGHT)
break
for device in devices[COVER].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, COVER)
break
for device in devices[IRRIGATION].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, IRRIGATION)
break
for device in devices[OTHER].values():
if device.index == INDEX:
await execute_device_test(bridge_api, device, OTHER)
break
print("-" * 20)
print("Logout & close session")
await bridge_api.logout()
await bridge_api.close()
Expand Down

0 comments on commit b81c324

Please sign in to comment.