-
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
1 parent
752fe35
commit a3fef82
Showing
7 changed files
with
108 additions
and
341 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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from typing import Any, Dict | ||
from unittest import TestCase | ||
from unittest.mock import MagicMock, patch | ||
|
||
import resend | ||
|
||
# flake8: noqa | ||
|
||
|
||
class ResendBaseTest(TestCase): | ||
def setUp(self) -> None: | ||
resend.api_key = "re_123" | ||
|
||
self.patcher = patch("resend.Request.make_request") | ||
self.mock = self.patcher.start() | ||
self.mock.status_code = 200 | ||
self.m = MagicMock() | ||
self.m.status_code = 200 | ||
self.mock.return_value = self.m | ||
|
||
def tearDown(self) -> None: | ||
self.patcher.stop() | ||
|
||
def set_mock_json(self, mock_json: Dict[Any, Any]) -> None: | ||
"""Auxiliary function to set the mock json return value""" | ||
self.m.json = lambda: mock_json | ||
|
||
def set_mock_text(self, mock_text: str) -> None: | ||
"""Auxiliary function to set the mock text return value""" | ||
self.m.text = mock_text |
Oops, something went wrong.