python-kasa/kasa/tests
Steven B 9cffbe9e48
Support child devices in all applicable cli commands (#1020)
Adds a new decorator that adds child options to a command and gets the
child device if the options are set.

- Single definition of options and error handling
- Adds options automatically to command
- Backwards compatible with `--index` and `--name`
- `--child` allows for id and alias for ease of use
- Omitting a value for `--child` gives an interactive prompt

Implements private `_update` to allow the CLI to patch a child `update`
method to call the parent device `update`.

Example help output:
```
$ kasa brightness --help
Usage: kasa brightness [OPTIONS] [BRIGHTNESS]

  Get or set brightness.

Options:
  --transition INTEGER
  --child, --name TEXT            Child ID or alias for controlling sub-
                                  devices. If no value provided will show an
                                  interactive prompt allowing you to select a
                                  child.
  --child-index, --index INTEGER  Child index controlling sub-devices
  --help                          Show this message and exit.
```

Fixes #769
2024-07-02 15:11:19 +02:00
..
fixtures Add L920(EU) v1.1.3 fixture (#1031) 2024-07-02 13:36:57 +01:00
smart Fix changing brightness when effect is active (#1019) 2024-07-01 13:59:24 +02:00
__init__.py mass rename to (python-)kasa (#1) 2019-12-18 09:11:18 +01:00
conftest.py Fix potential infinite loop if incomplete lists returned (#920) 2024-05-19 10:34:52 +01:00
device_fixtures.py Update light transition module to work with child devices (#1017) 2024-06-27 18:52:54 +01:00
discovery_fixtures.py Update light transition module to work with child devices (#1017) 2024-06-27 18:52:54 +01:00
fakeprotocol_iot.py Fix credential hash to return None on empty credentials (#1029) 2024-07-02 13:43:37 +01:00
fakeprotocol_smart.py Fix changing brightness when effect is active (#1019) 2024-07-01 13:59:24 +02:00
fixtureinfo.py Update light transition module to work with child devices (#1017) 2024-06-27 18:52:54 +01:00
test_aestransport.py Handle unknown error codes gracefully (#1016) 2024-06-27 16:58:45 +02:00
test_bulb.py Add some device fixtures (#948) 2024-06-04 19:24:53 +02:00
test_childdevice.py Make parent attribute on device consistent across iot and smart (#1023) 2024-07-01 11:51:06 +01:00
test_cli.py Support child devices in all applicable cli commands (#1020) 2024-07-02 15:11:19 +02:00
test_common_modules.py Fix changing brightness when effect is active (#1019) 2024-07-01 13:59:24 +02:00
test_device_factory.py Update light transition module to work with child devices (#1017) 2024-06-27 18:52:54 +01:00
test_device_type.py Refactor devices into subpackages and deprecate old names (#716) 2024-02-04 16:20:08 +01:00
test_device.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
test_deviceconfig.py Rename and deprecate exception classes (#739) 2024-02-21 16:52:55 +01:00
test_dimmer.py Fix set_state for common light modules (#929) 2024-05-22 15:33:55 +02:00
test_discovery.py Make device initialisation easier by reducing required imports (#936) 2024-06-03 19:06:54 +01:00
test_emeter.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
test_feature.py Require explicit feature type (#1006) 2024-06-25 18:30:36 +02:00
test_httpclient.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
test_iotdevice.py Drop python3.8 support (#992) 2024-06-19 20:24:12 +02:00
test_klapprotocol.py Retry query on 403 after succesful handshake (#785) 2024-02-22 18:02:03 +01:00
test_lightstrip.py Make Light and Fan a common module interface (#911) 2024-05-13 17:34:44 +01:00
test_plug.py Refactor split smartdevice tests to test_{iot,smart}device (#822) 2024-03-15 15:55:48 +00:00
test_protocol.py Fix credential hash to return None on empty credentials (#1029) 2024-07-02 13:43:37 +01:00
test_readme_examples.py Update docs with more howto examples (#968) 2024-06-19 09:53:40 +01:00
test_smartdevice.py Drop python3.8 support (#992) 2024-06-19 20:24:12 +02:00
test_smartprotocol.py Disable multi requests on json decode error during multi-request (#1025) 2024-07-01 13:57:13 +01:00
test_strip.py Fix post update hook for iot child devices (#1011) 2024-06-25 17:58:07 +00:00
test_usage.py Refactor devices into subpackages and deprecate old names (#716) 2024-02-04 16:20:08 +01:00