-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add an admin-only endpoint for test mail #6041
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
a0f5f8b to
eb4db7c
Compare
Codecov Report
@@ Coverage Diff @@
## development #6041 +/- ##
==============================================
Coverage ? 66.15%
==============================================
Files ? 285
Lines ? 14063
Branches ? 0
==============================================
Hits ? 9304
Misses ? 4759
Partials ? 0
Continue to review full report at Codecov.
|
app/api/settings.py
Outdated
| @admin_misc_routes.route('/test-mail', methods=['POST']) | ||
| def test_email_setup(): | ||
| if 'Authorization' in request.headers: | ||
| _jwt_required(app.config['JWT_DEFAULT_REALM']) |
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.
Why not using decorator?
3ed2419 to
6cc3b6f
Compare
|
@iamareebjamal I completely forgot about the custom decorators, have updated the PR. |
app/api/settings.py
Outdated
| recipient = request.json['recipient'] | ||
| except KeyError: | ||
| return UnprocessableEntityError( | ||
| {'source': ''}, 'Invalid request payload').respond() |
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.
Better to only use exception handling in exceptional cases
recipient = request.json.get('recipient')
if not recipient:
return UnprocessableEntityError({'source': 'recipient'}, 'Required parameter recipient not found').respond() // explicit error message
# continue with happy path|
@iamareebjamal Thanks for the review, I have made the changes. |
Fixes #6040
Changes proposed in this pull request: