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

Initial Unit Tests #112

Merged
merged 15 commits into from
Mar 31, 2025
Merged

Initial Unit Tests #112

merged 15 commits into from
Mar 31, 2025

Conversation

halprin
Copy link
Member

@halprin halprin commented Mar 27, 2025

Changes proposed in this pull request

Changed the organization of the code. In external, I added an aws module and moved most of everything external in there. Created a documents module that will contain nearly all of our usecases for now.

Moved a lot of logic from the Lambda handlers into a new usecase. This is better organization of the code, and will aid in testing.

Created some unit tests for testing the usecases.

Made the unit tests run as part of the CI pipeline.

Towards #110.

@halprin halprin changed the title Issue 110 test with app context Initial Unit Tests with Application Context Mar 31, 2025
@halprin halprin marked this pull request as ready for review March 31, 2025 19:37
@halprin halprin requested a review from a team as a code owner March 31, 2025 19:37
@halprin halprin enabled auto-merge March 31, 2025 19:38
@halprin halprin changed the title Initial Unit Tests with Application Context Initial Unit Tests Mar 31, 2025
@halprin halprin disabled auto-merge March 31, 2025 20:08
@halprin halprin enabled auto-merge March 31, 2025 20:08

- name: Python unit testing
working-directory: ./backend/
run: uv run pytest
Copy link
Contributor

Choose a reason for hiding this comment

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

A question, will we eventually want to run a percentage check for unit test as well? Or do you see you see this as something we might add later on. I see it as the latter but would like to know your opinion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, eventually. Right now we're at some super low percentage. Sadness. But yes, something later on.

@@ -0,0 +1,58 @@
import json
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think the refactor work I did for src/external/lambdas/helpers/s3_file_upload_helper.py moving someplace like src/storage/cloud_upload.py or something of that nature?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't thinking storage, but in documents. So, src/documents/new_document.py, upload_document.py, or something like that.

@@ -0,0 +1,63 @@
import json
import logging
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall I also include adding logging over our print statements? I thought we had a story for this but I don't mind the approach of refactoring as we go through testing either.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you have the presence of mind to convert to logging, yes, please do it.

Copy link
Contributor

@saquino0827 saquino0827 left a comment

Choose a reason for hiding this comment

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

Looks good! I left some comments that were more questions for my understanding.

@halprin halprin merged commit 2b24b4f into main Mar 31, 2025
11 checks passed
@halprin halprin deleted the issue-110-test_with_app_context branch March 31, 2025 20:26
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.

2 participants