Skip to content
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

feat: rework auth flow - part 2 #221

Merged
merged 6 commits into from
Jul 12, 2024

Conversation

chemelli74
Copy link
Member

@chemelli74 chemelli74 commented Jul 12, 2024

See #205 for reference

Summary by CodeRabbit

  • New Features

    • Introduced new functions to retrieve default cloud names and preset account credentials.
  • Bug Fixes

    • Updated cloud selection options to reflect the correct cloud names.
  • Tests

    • Added test cases for new functions related to default cloud selection and preset account data retrieval.

Copy link
Contributor

coderabbitai bot commented Jul 12, 2024

Walkthrough

The changes introduce a set of updates across multiple files, primarily involving the replacement of a clouds dictionary with a SUPPORTED_CLOUDS dictionary to improve clarity. Additionally, new functions are added for default cloud selection and retrieving preset account data. Tests are also updated to include these new functions.

Changes

Files Change Summaries
library_test.py, cli.py Updated import statements and help messages to use SUPPORTED_CLOUDS instead of clouds.
midealocal/cloud.py Renamed clouds dictionary to SUPPORTED_CLOUDS, added get_default_cloud() and get_preset_account_cloud() functions, and modified related class initializations.
tests/cloud_test.py Introduced tests for the new get_default_cloud and get_preset_account_cloud functions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant CloudModule as Cloud Module
    participant CloudClass as Cloud Class

    User->>CLI: Run command with cloud option
    CLI->>CloudModule: Import SUPPORTED_CLOUDS
    CLI->>User: Display help with SUPPORTED_CLOUDS.keys()
    User->>CloudModule: Select default cloud
    CloudModule->>CloudClass: Initialize with default cloud
    User->>CloudModule: Fetch preset account data
    CloudModule->>User: Return preset account data
Loading

Poem

In the realm where clouds abound,
A simpler name they now have found,
Default paths and preset ways,
Guide the user through the haze.
With tests to prove the code is sound,
In this new structure, joy is found. 🌤️🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov-commenter
Copy link

codecov-commenter commented Jul 12, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.

Project coverage is 32.94%. Comparing base (0f34b2c) to head (cf6d07a).

Files Patch % Lines
midealocal/cli.py 0.00% 1 Missing ⚠️
midealocal/cloud.py 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #221      +/-   ##
==========================================
+ Coverage   32.82%   32.94%   +0.12%     
==========================================
  Files          80       80              
  Lines        6985     6999      +14     
==========================================
+ Hits         2293     2306      +13     
- Misses       4692     4693       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b364248 and 297648b.

Files selected for processing (3)
  • library_test.py (2 hunks)
  • midealocal/cli.py (2 hunks)
  • midealocal/cloud.py (8 hunks)
Additional comments not posted (10)
library_test.py (2)

13-13: LGTM! Import statement updated correctly.

The import statement has been updated to use SUPPORTED_CLOUDS, which aligns with the new dictionary name.


34-34: LGTM! Help message updated correctly.

The help message string has been updated to use SUPPORTED_CLOUDS.keys(), which aligns with the new dictionary name.

midealocal/cli.py (2)

17-17: LGTM! Import statement updated correctly.

The import statement has been updated to use SUPPORTED_CLOUDS, which aligns with the new dictionary name.


162-162: LGTM! Choices for cloud selection updated correctly.

The choices for cloud selection have been updated to use SUPPORTED_CLOUDS.keys(), which aligns with the new dictionary name.

midealocal/cloud.py (6)

Line range hint 29-74:
LGTM! Dictionary renamed correctly.

The dictionary clouds has been renamed to SUPPORTED_CLOUDS, which provides better clarity.

Tools
Gitleaks

47-47: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


89-111: LGTM! New functions added correctly.

The functions get_default_cloud() and get_preset_account_cloud() are correctly implemented and provide useful functionality.


291-303: LGTM! Class initialization updated correctly.

The initialization of the class MeijuCloud has been updated to use SUPPORTED_CLOUDS, which aligns with the new dictionary name.


485-502: LGTM! Class initialization updated correctly.

The initialization of the class MSmartHomeCloud has been updated to use SUPPORTED_CLOUDS, which aligns with the new dictionary name.


679-687: LGTM! Class initialization updated correctly.

The initialization of the class MideaAirCloud has been updated to use SUPPORTED_CLOUDS, which aligns with the new dictionary name.


820-828: LGTM! Function updated correctly.

The function get_midea_cloud has been updated to use SUPPORTED_CLOUDS, which aligns with the new dictionary name.

@rokam rokam changed the title feat: rework auth flow - part 2 feat: rework auth flow - part II Jul 12, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 297648b and e4277dd.

Files selected for processing (3)
  • library_test.py (2 hunks)
  • midealocal/cli.py (2 hunks)
  • midealocal/cloud.py (8 hunks)
Files skipped from review due to trivial changes (1)
  • library_test.py
Files skipped from review as they are similar to previous changes (2)
  • midealocal/cli.py
  • midealocal/cloud.py

@rokam rokam changed the title feat: rework auth flow - part II feat: rework auth flow - part 2 Jul 12, 2024
Copy link
Contributor

@rokam rokam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add coverage for the new method inside cloud.

Copy link
Contributor

@rokam rokam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e4277dd and cf6d07a.

Files selected for processing (1)
  • tests/cloud_test.py (2 hunks)
Additional comments not posted (2)
tests/cloud_test.py (2)

60-63: Verify the correctness of the default cloud name.

Ensure that MSmartHome is the correct default cloud name as per the implementation of get_default_cloud.


70-75: Verify the correctness of the preset cloud account credentials.

Ensure that the expected values for username, password, and cloud_name are correct as per the implementation of get_preset_account_cloud.

@chemelli74 chemelli74 merged commit f74ff8e into midea-lan:main Jul 12, 2024
9 checks passed
@chemelli74 chemelli74 deleted the chemelli74-preset-account branch July 12, 2024 14:16
@rokam rokam mentioned this pull request Jul 12, 2024
rokam added a commit that referenced this pull request Jul 13, 2024
🤖 I have created a release *beep* *boop*
---


## [2.0.0](v1.3.2...v2.0.0)
(2024-07-12)


### ⚠ BREAKING CHANGES

* rework auth flow - part 1
([#219](#219))
([d8ac4fb](d8ac4fb))

### Features

* **cli:** download protocol
([#214](#214))
([7a99374](7a99374))
* rework auth flow - part 1
([#219](#219))
([d8ac4fb](d8ac4fb))
* rework auth flow - part 2
([#221](#221))
([f74ff8e](f74ff8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Reworked authentication flow to enhance user security and ease of use.
  - CLI download protocol; 

- **BREAKING CHANGE**
- Cloud key retrieval segmentated. Updating to version 2.0.0 is required
for continued functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
wuwentao pushed a commit that referenced this pull request Jul 19, 2024
See #205 for reference

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced new functions to retrieve default cloud names and preset
account credentials.
  
- **Bug Fixes**
  - Updated cloud selection options to reflect the correct cloud names.

- **Tests**
- Added test cases for new functions related to default cloud selection
and preset account data retrieval.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Lucas Mindêllo de Andrade <lucas@mindello.com.br>
wuwentao pushed a commit that referenced this pull request Jul 19, 2024
🤖 I have created a release *beep* *boop*
---


## [2.0.0](v1.3.2...v2.0.0)
(2024-07-12)


### ⚠ BREAKING CHANGES

* rework auth flow - part 1
([#219](#219))
([d8ac4fb](d8ac4fb))

### Features

* **cli:** download protocol
([#214](#214))
([7a99374](7a99374))
* rework auth flow - part 1
([#219](#219))
([d8ac4fb](d8ac4fb))
* rework auth flow - part 2
([#221](#221))
([f74ff8e](f74ff8e))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Reworked authentication flow to enhance user security and ease of use.
  - CLI download protocol; 

- **BREAKING CHANGE**
- Cloud key retrieval segmentated. Updating to version 2.0.0 is required
for continued functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants