-
Notifications
You must be signed in to change notification settings - Fork 9
Rename smile to api #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename smile to api #766
Conversation
to avoid smile.smile.xyz constructs
WalkthroughAll test files were updated to consistently rename the variable previously called Changes
Sequence Diagram(s)sequenceDiagram
participant TestFunction
participant API as api (formerly smile)
participant Device
TestFunction->>API: connect_wrapper() / connect_legacy_wrapper()
API->>Device: Establish connection
TestFunction->>API: Call device methods (e.g., device_test, tinker_thermostat)
API->>Device: Perform requested action
TestFunction->>API: close_connection()
API->>Device: Close connection
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Pylint (3.3.7)tests/test_adam.pytests/test_anna.pytests/test_generic.py
✨ Finishing Touches
🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #766 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 3382 3382
=========================================
Hits 3382 3382 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/test_init.py (1)
480-492
: Parameter rename propagated, but default value remains odd
device_test(self, api=pw_smile.Smile, …)
still defaults to the class rather than an instance, which is unchanged behaviour but a little surprising. Not introduced by this PR, so no action required now, just flagging for future cleanup.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
tests/test_adam.py
(12 hunks)tests/test_anna.py
(24 hunks)tests/test_generic.py
(2 hunks)tests/test_init.py
(28 hunks)tests/test_legacy_anna.py
(2 hunks)tests/test_legacy_generic.py
(1 hunks)tests/test_legacy_p1.py
(3 hunks)tests/test_legacy_stretch.py
(4 hunks)tests/test_p1.py
(4 hunks)
🧰 Additional context used
🧠 Learnings (8)
tests/test_legacy_generic.py (2)
Learnt from: bouwew
PR: plugwise/python-plugwise#627
File: tests/test_init.py:340-340
Timestamp: 2024-10-08T15:35:25.180Z
Learning: In `tests/test_init.py`, within the `connect` method, the `stretch` parameter is not relevant.
Learnt from: bouwew
PR: plugwise/python-plugwise#627
File: tests/test_init.py:340-340
Timestamp: 2024-09-25T09:00:19.434Z
Learning: In `tests/test_init.py`, within the `connect` method, the `stretch` parameter is not relevant.
tests/test_legacy_p1.py (2)
Learnt from: bouwew
PR: plugwise/python-plugwise#678
File: plugwise/legacy/helper.py:69-69
Timestamp: 2024-12-22T09:37:24.648Z
Learning: The code in plugwise/legacy/helper.py is fully separated from plugwise/helper.py. The user indicates that the problem signaled about the mismatch of the variable name (_home_location vs _home_loc_id) does not actually apply.
Learnt from: CoMPaTech
PR: plugwise/python-plugwise#698
File: fixtures/m_adam_multiple_devices_per_zone/data.json:21-21
Timestamp: 2025-01-29T19:14:31.257Z
Learning: MAC addresses in test fixtures of the python-plugwise repository are mock addresses and do not represent real device information.
tests/test_adam.py (1)
Learnt from: CoMPaTech
PR: plugwise/python-plugwise#698
File: fixtures/m_adam_multiple_devices_per_zone/data.json:21-21
Timestamp: 2025-01-29T19:14:31.257Z
Learning: MAC addresses in test fixtures of the python-plugwise repository are mock addresses and do not represent real device information.
tests/test_legacy_anna.py (1)
Learnt from: bouwew
PR: plugwise/python-plugwise#678
File: plugwise/legacy/helper.py:69-69
Timestamp: 2024-12-22T09:37:24.648Z
Learning: The code in plugwise/legacy/helper.py is fully separated from plugwise/helper.py. The user indicates that the problem signaled about the mismatch of the variable name (_home_location vs _home_loc_id) does not actually apply.
tests/test_legacy_stretch.py (3)
Learnt from: bouwew
PR: plugwise/python-plugwise#627
File: tests/test_init.py:340-340
Timestamp: 2024-09-25T09:00:19.434Z
Learning: In `tests/test_init.py`, within the `connect` method, the `stretch` parameter is not relevant.
Learnt from: bouwew
PR: plugwise/python-plugwise#627
File: tests/test_init.py:340-340
Timestamp: 2024-10-08T15:35:25.180Z
Learning: In `tests/test_init.py`, within the `connect` method, the `stretch` parameter is not relevant.
Learnt from: bouwew
PR: plugwise/python-plugwise#678
File: plugwise/legacy/helper.py:69-69
Timestamp: 2024-12-22T09:37:24.648Z
Learning: The code in plugwise/legacy/helper.py is fully separated from plugwise/helper.py. The user indicates that the problem signaled about the mismatch of the variable name (_home_location vs _home_loc_id) does not actually apply.
tests/test_p1.py (1)
Learnt from: CoMPaTech
PR: plugwise/python-plugwise#698
File: fixtures/m_adam_multiple_devices_per_zone/data.json:21-21
Timestamp: 2025-01-29T19:14:31.257Z
Learning: MAC addresses in test fixtures of the python-plugwise repository are mock addresses and do not represent real device information.
tests/test_anna.py (3)
Learnt from: bouwew
PR: plugwise/python-plugwise#678
File: plugwise/legacy/helper.py:69-69
Timestamp: 2024-12-22T09:37:24.648Z
Learning: The code in plugwise/legacy/helper.py is fully separated from plugwise/helper.py. The user indicates that the problem signaled about the mismatch of the variable name (_home_location vs _home_loc_id) does not actually apply.
Learnt from: bouwew
PR: plugwise/python-plugwise#671
File: plugwise/legacy/data.py:97-106
Timestamp: 2024-12-13T11:26:00.100Z
Learning: In `plugwise/legacy/data.py`, the legacy thermostat does not support cooling, so handling of the cooling state is unnecessary in this code.
Learnt from: CoMPaTech
PR: plugwise/python-plugwise#698
File: fixtures/m_adam_multiple_devices_per_zone/data.json:21-21
Timestamp: 2025-01-29T19:14:31.257Z
Learning: MAC addresses in test fixtures of the python-plugwise repository are mock addresses and do not represent real device information.
tests/test_init.py (2)
Learnt from: bouwew
PR: plugwise/python-plugwise#678
File: plugwise/legacy/helper.py:69-69
Timestamp: 2024-12-22T09:37:24.648Z
Learning: The code in plugwise/legacy/helper.py is fully separated from plugwise/helper.py. The user indicates that the problem signaled about the mismatch of the variable name (_home_location vs _home_loc_id) does not actually apply.
Learnt from: bouwew
PR: plugwise/python-plugwise#671
File: plugwise/legacy/data.py:97-106
Timestamp: 2024-12-13T11:26:00.100Z
Learning: In `plugwise/legacy/data.py`, the legacy thermostat does not support cooling, so handling of the cooling state is unnecessary in this code.
🧬 Code Graph Analysis (5)
tests/test_legacy_generic.py (1)
tests/test_init.py (1)
connect_legacy_wrapper
(403-448)
tests/test_generic.py (1)
tests/test_init.py (1)
connect_wrapper
(366-401)
tests/test_legacy_anna.py (2)
tests/test_init.py (6)
connect_legacy_wrapper
(403-448)validate_test_basics
(988-1010)device_test
(480-601)tinker_legacy_thermostat
(828-845)disconnect
(453-456)tinker_legacy_thermostat_schedule
(765-789)plugwise/smilecomm.py (1)
close_connection
(148-150)
tests/test_legacy_stretch.py (2)
tests/test_init.py (4)
connect_legacy_wrapper
(403-448)validate_test_basics
(988-1010)device_test
(480-601)tinker_switch
(620-648)plugwise/smilecomm.py (1)
close_connection
(148-150)
tests/test_p1.py (5)
tests/test_init.py (3)
connect_wrapper
(366-401)validate_test_basics
(988-1010)device_test
(480-601)plugwise/__init__.py (1)
gateway_id
(96-98)plugwise/helper.py (1)
gateway_id
(90-92)plugwise/exceptions.py (1)
ResponseError
(36-37)plugwise/smilecomm.py (1)
close_connection
(148-150)
🪛 Gitleaks (8.26.0)
tests/test_adam.py
30-30: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
80-80: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
tests/test_legacy_stretch.py
74-74: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
78-78: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🔇 Additional comments (12)
tests/test_legacy_generic.py (1)
16-16
: LGTM! Variable renaming improves clarity.The renaming of
_smile
to_api
is consistent with the PR objective to avoid "smile.smile.xyz" constructs and makes the variable purpose clearer.tests/test_generic.py (2)
20-20
: LGTM! Consistent variable renaming.The renaming of
_smile
to_api
maintains consistency with the broader refactoring effort and improves code clarity.
62-62
: LGTM! Variable naming consistency maintained.The renaming of
smile
toapi
is consistent with the other changes in this file and across the codebase.tests/test_adam.py (1)
25-181
: LGTM! Comprehensive and consistent variable renaming.The systematic renaming of
smile
toapi
throughout all test methods is well-executed and consistent. This change successfully achieves the PR objective of avoiding "smile.smile.xyz" constructs while preserving all test logic and functionality.Note: The static analysis hints about "Generic API Key" are false positives - they're detecting variable names containing "api" rather than actual API keys.
tests/test_legacy_anna.py (1)
21-76
: LGTM! Consistent variable renaming across test methods.The renaming of
smile
toapi
is comprehensive and consistent across both test methods. All references have been properly updated while preserving the original test logic and functionality.tests/test_legacy_p1.py (1)
19-67
: LGTM! Final consistent variable renaming completes the refactoring.The renaming of
smile
toapi
across both test methods is comprehensive and consistent, completing the systematic refactoring effort across the test suite. All references have been properly updated while maintaining the original test functionality.tests/test_legacy_stretch.py (2)
19-28
: Rename looks good – no functional impact detectedTuple unpacking and all subsequent references were updated from
smile
→api
. The change is self-contained, keeps the order(server, api, client)
consistent with the value returned byconnect_legacy_wrapper
, and doesn’t touch test logic or assertions.
73-86
: Static-analysis “API-key” warnings are false positivesThe long hexadecimal strings (
2587a7fcdd7e…
) are fixture device-ids, not credentials. No remediation needed; you can safely ignore the Gitleaks generic-API-key warnings.tests/test_p1.py (1)
18-26
: Consistent variable rename
server, api, client
unpacking and every downstream use ofapi
were updated correctly; test behaviour remains unchanged.tests/test_anna.py (2)
21-33
:api
rename applied correctlyAll occurrences in the v4 test path were switched to
api
, including assertions and calls to helper functions. No missed references detected.
667-678
: Confirmed: no remainingsmile=
keyword arguments—rename is safeI’ve searched the entire codebase for
smile=
and found no occurrences. Theapi.smile.name
access insidetinker_thermostat_temp
still refers to the correct domain object, so no changes are needed here.tests/test_init.py (1)
323-338
: Constructor invocation updated – ✅Both the “no websession” negative test and the real constructor call now use
api
consistently. Return tuple at line 355 aligns with callers (server, api, client
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt it needs a full review (with a lot of renames) :)
A bit of "monniken-werk", but with find-replace well doable :) |
I know most IDEs can just replace 'all occurances' intelligently but I'm always a bit reluctant with them :) Great work, @bouwew |
to avoid smile.smile.xyz constructs
Summary by CodeRabbit
Refactor
smile
toapi
across all test files. No changes were made to test logic or behavior.Tests