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

Refactor d2x.gen and d2x.parse as Pydantic models #44

Merged
merged 14 commits into from
Oct 31, 2024

Conversation

jlantz
Copy link
Contributor

@jlantz jlantz commented Oct 30, 2024

Refactor d2x.gen and d2x.parse functions into Pydantic models and update all callers.

  • Add Pydantic Models:

    • Add LoginUrlModel to d2x/models/sf/auth.py to replace get_login_url_and_token function.
    • Add SfdxAuthUrlModel to d2x/models/sf/auth.py to replace parse_sfdx_auth_url function.
  • Update Callers:

    • Update d2x/auth/sf/auth_url.py to use SfdxAuthUrlModel for parsing SFDX auth URL.
    • Update d2x/auth/sf/login_url.py to use LoginUrlModel for generating login URL.
    • Update d2x/cli/main.py to import LoginUrlModel and SfdxAuthUrlModel.
  • Remove Deprecated Files:

    • Delete d2x/gen/sf/login_url.py.
    • Delete d2x/parse/sf/auth_url.py.

For more details, open the Copilot Workspace session.

jlantz added 13 commits October 30, 2024 18:46
Refactor `d2x.gen` and `d2x.parse` functions into Pydantic models and update all callers.

* **Add Pydantic Models:**
  - Add `LoginUrlModel` to `d2x/models/sf/auth.py` to replace `get_login_url_and_token` function.
  - Add `SfdxAuthUrlModel` to `d2x/models/sf/auth.py` to replace `parse_sfdx_auth_url` function.

* **Update Callers:**
  - Update `d2x/auth/sf/auth_url.py` to use `SfdxAuthUrlModel` for parsing SFDX auth URL.
  - Update `d2x/auth/sf/login_url.py` to use `LoginUrlModel` for generating login URL.
  - Update `d2x/cli/main.py` to import `LoginUrlModel` and `SfdxAuthUrlModel`.

* **Remove Deprecated Files:**
  - Delete `d2x/gen/sf/login_url.py`.
  - Delete `d2x/parse/sf/auth_url.py`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/muselab-d2x/d2x/tree/jlantz/update-auth-structure?shareId=XXXX-XXXX-XXXX-XXXX).
* **LoginUrlModel tests**
  - Test successful instantiation and method call
  - Test instantiation with missing access token
  - Test instantiation with missing login URL

* **SfdxAuthUrlModel tests**
  - Test successful instantiation and method call
  - Test instantiation with invalid URL
* Set `DEMO` to "demo" in the `OrgType` Enum
* Import the `re` module at the top of the file
* Import the `re` module at the top of the file
* Import the `re` module at the top of the file
…empty `ret_url` parameter

* Encode `ret_url` parameter as "%2F" if it is empty
* Define a new GitHub Actions workflow for running Python tests
* Trigger the workflow on push and pull request events to the main and releases branches
* Use the starter workflow for Python tests with Python version 3.10
* Set up Python environment and install dependencies
* Run tests and generate coverage report
* Upload coverage report to Codecov
* Generate and upload test report
* Post test summary to GitHub step summary
* Add a reusable workflow for Python tests in `.github/workflows/python-test.yml`
* Update branches to include 'main' and 'releases/**'
* Remove `branches` section from `pull_request` block
* Add a `jobs` section with a `test` job that runs on `ubuntu-latest`
@jlantz jlantz merged commit 8462b62 into jlantz/update-auth-structure Oct 31, 2024
1 of 2 checks passed
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.

1 participant