-
-
Notifications
You must be signed in to change notification settings - Fork 45
Refactor Nonce class #296
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
base: min-devel
Are you sure you want to change the base?
Refactor Nonce class #296
Conversation
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.
Pull request overview
This PR refactors the Nonce class by introducing a repository pattern for database operations. The changes improve separation of concerns by moving all database interactions to a dedicated NonceRepository class, while the Nonce class focuses on business logic.
- Introduced
NonceRepositoryclass to encapsulate database operations (check, delete, add) - Renamed private methods for clarity:
_new→_generate_nonce_value,_check_and_delete→_validate_and_consume_nonce - Updated all tests to reflect the new method names and maintain coverage
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| acme_srv/nonce.py | Introduces NonceRepository abstraction and refactors Nonce class to delegate database operations to the repository |
| test/test_nonce.py | Updates test method names, mock patches, and docstrings to align with renamed private methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR refactors the Nonce class and its test suite to improve maintainability, robustness, and clarity, while preserving all public interfaces and backward compatibility.