Update smartcam credential handling and tests by ZeliardM · Pull Request #1664 · python-kasa/python-kasa
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds first-class support for updating SMARTCAM admin password (library + CLI) and corrects SMARTCAM local credential updates to target the proper local account identity, with expanded test coverage to validate request payloads and fallback behavior.
Changes:
- Add
SmartCamDevice.update_admin_password()plus shared password encryption/hash helpers. - Update
SmartCamDevice.update_credentials()to usesecname="local_account"and improved old-password fallback handling. - Add CLI
update_admin_passwordcommand and extend smartcam/CLI tests for new/updated behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
kasa/smartcam/smartcamdevice.py |
Adds admin password update API, refactors RSA encryption into _encrypt_password, and updates credential update request construction/fallbacks. |
kasa/cli/device.py |
Adds device update-admin-password command (implemented as update_admin_password). |
kasa/cli/main.py |
Exposes update_admin_password as a top-level runnable device command via lazy subcommand mapping. |
tests/test_cli.py |
Adds CLI test covering confirmation prompt + invocation of update_admin_password. |
tests/smartcam/test_smartcamdevice.py |
Adds extensive unit tests validating request payloads for LV2/LV3 and fallback behavior for both admin password and credentials updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.