-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat(test): add unit tests for encrypt and time_friendly modules #1163
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: main
Are you sure you want to change the base?
feat(test): add unit tests for encrypt and time_friendly modules #1163
Conversation
- Add pytest configuration to pyproject.toml with dev dependencies - Create test structure mirroring app/component path (per eigent-ai#1039) - Add comprehensive tests for password_hash and password_verify functions - Add tests for to_date and monday_start_time utility functions - Include conftest.py with path setup for proper imports - Cover edge cases: unicode, special chars, None handling Contributes to eigent-ai#1039
|
thanks @thecaptain789 's contribution! |
bytecii
left a comment
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.
In general LGTM. Left some comments.
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. ========= | ||
| """Unit tests for app.component.time_friendly module.""" |
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.
remove
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. ========= | ||
| """Unit tests for app.component.encrypt module.""" |
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.
remove
| from app.component.time_friendly import monday_start_time, to_date | ||
|
|
||
|
|
||
| class TestToDate: |
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.
Maybe just use def test_xxx as the tests are quite simple.
| from app.component.encrypt import password_hash, password_verify | ||
|
|
||
|
|
||
| class TestPasswordHash: |
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.
Maybe just use def test_xxx as the tests are quite simple.
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.
Can we also remove these init in the tests?
- Convert class-based tests to simple function-based tests - Remove unnecessary __init__.py from test directory - Remove pytest import where not needed
- Remove __init__.py files from test directories - Shorten test function names for clarity
|
Hi @bytecii, thanks for the review! I've addressed your feedback in the latest commits:
Let me know if anything else is needed! |
Summary
Adds comprehensive unit tests for the
app.component.encryptandapp.component.time_friendlymodules.Changes
pyproject.tomltests/app/component/directory structure mirroring source code (per test: create pytest unit tests with clearer mirroring to original code path #1039)Testing
Related Issues
Contributes to #1039 (create pytest unit tests with clearer mirroring to original code path)
Checklist
tests/app/component/test_xxx.pynaming convention