-
Notifications
You must be signed in to change notification settings - Fork 1
Hw1: add FastAPI for interacting with mail client, plus adapter to act like a mail client... version 2 #4
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
Conversation
| import os | ||
| from typing import Annotated | ||
|
|
||
| if os.environ.get("MOCK_CLIENT") == "1": |
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.
I wouldn't say this is the best way to do this -- you're coupling application code with test code. I would recommend removing test_client.py and using MagicMock to create a mock client in your unit tests instead.
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.
I wouldn't either but I have not found a way to patch it then run with uvicorn in the integration test (which is not supposed to be with production credentials) so unfortunately that's the current compromise. Maybe I'll look into it further later on.
|
Overall, nice work! Your peers gave you good feedback and you've made the right changes. The structure of your components is spot on. Your service is now correct as well (needs some minor fixes). Your adapter correctly implements the mail_client_api.Client interface which calls methods on the autogenerated client internally. Well done! |
Pull Request
Summary
Adapt hw1 code, actually call it an adapter as assignment indicated, fix tests, and make CircleCI pass.
Related Issues
Change Type
Impacted Areas
mail_client_apigmail_client_implTesting
Commands executed
Results
Quality Checklist
Notes for Reviewers