-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
65 additions
and
16 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ import resend | |
resend.api_key = "re_yourkey" | ||
|
||
params: resend.Emails.SendParams = { | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hi", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -10,13 +10,13 @@ | |
|
||
params: List[resend.Emails.SendParams] = [ | ||
{ | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hey", | ||
"html": "<strong>hello, world!</strong>", | ||
}, | ||
{ | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hello", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
raise EnvironmentError("RESEND_API_KEY is missing") | ||
|
||
params: resend.Emails.SendParams = { | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hi", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
|
||
# Define the email parameters | ||
params: resend.Emails.SendParams = { | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hi", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
# Email params | ||
params: resend.Emails.SendParams = { | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hello with base64 attachments", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
raise EnvironmentError("RESEND_API_KEY is missing") | ||
|
||
params: resend.Emails.SendParams = { | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["invalid"], | ||
"subject": "hi", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
|
||
# Email params | ||
params: resend.Emails.SendParams = { | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hello with base64 attachments", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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
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 |
---|---|---|
|
@@ -30,13 +30,13 @@ def mock_json() -> Dict[Any, Any]: | |
|
||
params: List[resend.Emails.SendParams] = [ | ||
{ | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hey", | ||
"html": "<strong>hello, world!</strong>", | ||
}, | ||
{ | ||
"from_": "[email protected]", | ||
"from": "[email protected]", | ||
"to": ["[email protected]"], | ||
"subject": "hello", | ||
"html": "<strong>hello, world!</strong>", | ||
|
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 |
---|---|---|
|
@@ -8,6 +8,34 @@ | |
|
||
|
||
class TestResendEmail(unittest.TestCase): | ||
|
||
def test_email_send_with_from(self) -> None: | ||
resend.api_key = "re_123" | ||
|
||
patcher = patch("resend.Request.make_request") | ||
mock = patcher.start() | ||
mock.status_code = 200 | ||
m = MagicMock() | ||
m.status_code = 200 | ||
|
||
def mock_json() -> Dict[Any, Any]: | ||
return { | ||
"id": "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794", | ||
} | ||
|
||
m.json = mock_json | ||
mock.return_value = m | ||
|
||
params: resend.Emails.SendParams = { | ||
"to": "[email protected]", | ||
"from": "[email protected]", | ||
"subject": "subject", | ||
"html": "html", | ||
} | ||
email: resend.Email = resend.Emails.send(params) | ||
assert email.id == "49a3999c-0ce1-4ea6-ab68-afcd6dc2e794" | ||
patcher.stop() | ||
|
||
def test_email_send_with_sender(self) -> None: | ||
resend.api_key = "re_123" | ||
|
||
|