-
Notifications
You must be signed in to change notification settings - Fork 55
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
Support EU region endpoint #131
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6656af8
Add SENDGRID_HOST_URL setting to fix #129
mikemanger ccbca74
Bump mypy and add type check to fix issue
mikemanger 4f99b40
Remove unused import from test
mikemanger 6f054e5
Set mypy to 1.4.1
mikemanger d8453b6
Add https:// to API url
mikemanger 0ec25b3
Add seperate TESTING_SENDGRID_EU_API_KEY for testing EU sub accounts
mikemanger fad156f
Pass EU settings var to workflow
mikemanger bc3e7d9
Merge branch 'master' into support-eu-region
sklarsa 88441ec
Update tox config to pass TESTING_SENDGRID_EU_API_KEY to envs
mikemanger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
Header, | ||
MailSettings, | ||
Personalization, | ||
SpamCheck, | ||
Substitution, | ||
TrackingSettings, | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ class TestPostToSendgrid(SimpleTestCase): | |
) | ||
def test_post(self): | ||
""" | ||
Sends a POST to sendgrid's live API using a private API key that is stored | ||
Sends a POST to SendGrid's live API using a private API key that is stored | ||
in github. | ||
""" | ||
|
||
|
@@ -35,3 +35,34 @@ def test_post(self): | |
) | ||
val = msg.send() | ||
self.assertEqual(val, 1) | ||
|
||
# TESTING_SENDGRID_EU_API_KEY is only used for testing. | ||
@pytest.mark.skipif( | ||
not os.environ.get("TESTING_SENDGRID_EU_API_KEY"), | ||
reason="requires TESTING_SENDGRID_EU_API_KEY env var", | ||
) | ||
def test_eu_post(self): | ||
""" | ||
Sends a POST to SendGrid's live EU API using a private API key that is stored | ||
in GitHub. | ||
""" | ||
|
||
SENDGRID_API_KEY = os.environ.get("TESTING_SENDGRID_EU_API_KEY") | ||
|
||
# Set DEBUG=True so sandbox mode is enabled | ||
settings = { | ||
"DEBUG": True, | ||
"SENDGRID_API_KEY": SENDGRID_API_KEY, | ||
"SENDGRID_HOST_URL": "https://api.eu.sendgrid.com", | ||
"EMAIL_BACKEND": "sendgrid_backend.SendgridBackend", | ||
} | ||
|
||
with override_settings(**settings): | ||
msg = EmailMessage( | ||
subject="Hello, World!", | ||
body="Hello, World!", | ||
from_email="Sam Smith <[email protected]>", | ||
to=["John Doe <[email protected]>"], | ||
) | ||
val = msg.send() | ||
self.assertEqual(val, 1) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nice catch