Skip to content

Conversation

@abhinavk96
Copy link
Contributor

Fixes #6040

Changes proposed in this pull request:

  • Adds an endpoint which allows an admin or super admin to send test emails.

@auto-label auto-label bot added the feature label Jun 12, 2019
@abhinavk96 abhinavk96 force-pushed the development branch 2 times, most recently from a0f5f8b to eb4db7c Compare June 12, 2019 18:13
@fossasia fossasia deleted a comment from houndci-bot Jun 12, 2019
@fossasia fossasia deleted a comment from houndci-bot Jun 12, 2019
@codecov
Copy link

codecov bot commented Jun 12, 2019

Codecov Report

❗ No coverage uploaded for pull request base (development@0caf6a8). Click here to learn what that means.
The diff coverage is 64.7%.

Impacted file tree graph

@@              Coverage Diff               @@
##             development    #6041   +/-   ##
==============================================
  Coverage               ?   66.15%           
==============================================
  Files                  ?      285           
  Lines                  ?    14063           
  Branches               ?        0           
==============================================
  Hits                   ?     9304           
  Misses                 ?     4759           
  Partials               ?        0
Impacted Files Coverage Δ
app/api/helpers/system_mails.py 100% <ø> (ø)
app/__init__.py 86.78% <100%> (ø)
app/models/mail.py 82.35% <100%> (ø)
app/api/helpers/mail.py 29.67% <50%> (ø)
app/api/settings.py 62.22% <58.33%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0caf6a8...a814d10. Read the comment docs.

@admin_misc_routes.route('/test-mail', methods=['POST'])
def test_email_setup():
if 'Authorization' in request.headers:
_jwt_required(app.config['JWT_DEFAULT_REALM'])
Copy link
Member

Choose a reason for hiding this comment

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

Why not using decorator?

@abhinavk96 abhinavk96 force-pushed the development branch 2 times, most recently from 3ed2419 to 6cc3b6f Compare June 13, 2019 17:36
@abhinavk96 abhinavk96 requested a review from iamareebjamal June 13, 2019 17:36
@abhinavk96
Copy link
Contributor Author

abhinavk96 commented Jun 13, 2019

@iamareebjamal I completely forgot about the custom decorators, have updated the PR.

@fossasia fossasia deleted a comment from houndci-bot Jun 13, 2019
recipient = request.json['recipient']
except KeyError:
return UnprocessableEntityError(
{'source': ''}, 'Invalid request payload').respond()
Copy link
Member

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

@abhinavk96
Copy link
Contributor Author

@iamareebjamal Thanks for the review, I have made the changes.

iamareebjamal
iamareebjamal previously approved these changes Jun 14, 2019
@abhinavk96 abhinavk96 merged commit 3678dad into fossasia:development Jun 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an end point for sending test mails

2 participants