Update smartcam credential handling and tests#1664
Update smartcam credential handling and tests#1664ZeliardM wants to merge 5 commits intopython-kasa:masterfrom
Conversation
|
This should replace PR #1661, working with the user on this PR before they created their own. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1664 +/- ##
=======================================
Coverage 93.22% 93.22%
=======================================
Files 157 157
Lines 9815 9847 +32
Branches 1003 1009 +6
=======================================
+ Hits 9150 9180 +30
- Misses 472 473 +1
- Partials 193 194 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.
This PR adds update_admin_password in the library and CLI for SMARTCAM devices. It also updates the update_credentials function to correctly handle the local_account for local device authentication. It updates all of the required tests and code coverage as well.