-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from carpentries/feature/10-update-after-testing
Update after testing
- Loading branch information
Showing
11 changed files
with
260 additions
and
219 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1 @@ | ||
3.10 | ||
3.11 |
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 |
---|---|---|
|
@@ -14,21 +14,21 @@ | |
def scheduled_email_fixture() -> dict[str, Any]: | ||
now = datetime.now(tz=timezone.utc) | ||
return { | ||
"id": uuid4(), | ||
"pk": uuid4(), | ||
"created_at": now, | ||
"last_updated_at": now, | ||
"state": "scheduled", | ||
"scheduled_at": now, | ||
"to_header": ["[email protected]"], | ||
"to_header_context_json": '[{"api_uri": "api:person#1", "property": "email"}]', | ||
"to_header_context_json": [{"api_uri": "api:person#1", "property": "email"}], | ||
"from_header": "[email protected]", | ||
"reply_to_header": "", | ||
"cc_header": [], | ||
"bcc_header": [], | ||
"subject": "Sample email", | ||
"body": "Hello, {{ name }}!", | ||
"context_json": '{"name": "John"}', | ||
"template_id": uuid4(), | ||
"context_json": {"name": "John"}, | ||
"template": "Welcome email", | ||
} | ||
|
||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from datetime import datetime | ||
from datetime import UTC, datetime | ||
from typing import Any | ||
from unittest.mock import AsyncMock | ||
from uuid import uuid4 | ||
|
@@ -57,23 +57,23 @@ def test_render_email() -> None: | |
# Arrange | ||
engine = Environment(autoescape=True, undefined=DebugUndefined) | ||
id_ = uuid4() | ||
now_ = datetime.utcnow() | ||
now_ = datetime.now(tz=UTC) | ||
email = ScheduledEmail( | ||
id=id_, | ||
pk=id_, | ||
created_at=now_, | ||
last_updated_at=now_, | ||
state=ScheduledEmailStatus.SCHEDULED, | ||
scheduled_at=now_, | ||
to_header=[], | ||
to_header_context_json="[]", | ||
to_header_context_json=[], | ||
from_header="", | ||
reply_to_header="", | ||
cc_header=[], | ||
bcc_header=[], | ||
subject="Hello World and {{ name }}!", | ||
body="Welcome, {{ name }}!", | ||
context_json="{}", | ||
template_id=id_, | ||
context_json={}, | ||
template="Welcome email", | ||
) | ||
context = {"name": "John Doe"} | ||
recipients = ["[email protected]", ""] # empty string should be filtered out | ||
|
@@ -95,15 +95,15 @@ async def test_send_email() -> None: | |
# Arrange | ||
client = AsyncMock() | ||
id_ = uuid4() | ||
now_ = datetime.utcnow() | ||
now_ = datetime.now(tz=UTC) | ||
email = RenderedScheduledEmail( | ||
id=id_, | ||
pk=id_, | ||
created_at=now_, | ||
last_updated_at=now_, | ||
state=ScheduledEmailStatus.SCHEDULED, | ||
scheduled_at=now_, | ||
to_header=[], | ||
to_header_context_json="[]", | ||
to_header_context_json=[], | ||
to_header_rendered=["[email protected]"], | ||
from_header="", | ||
reply_to_header="", | ||
|
@@ -113,8 +113,8 @@ async def test_send_email() -> None: | |
subject_rendered="Hello World and John Doe!", | ||
body="Welcome, {{ name }}!", | ||
body_rendered="Welcome, John Doe!", | ||
context_json="{}", | ||
template_id=id_, | ||
context_json={}, | ||
template="Welcome email", | ||
) | ||
credentials = MailgunCredentials( | ||
MAILGUN_SENDER_DOMAIN="example.com", | ||
|
@@ -146,15 +146,15 @@ async def test_send_email__outgoing_addresses_overwritten() -> None: | |
# Arrange | ||
client = AsyncMock() | ||
id_ = uuid4() | ||
now_ = datetime.utcnow() | ||
now_ = datetime.now(tz=UTC) | ||
email = RenderedScheduledEmail( | ||
id=id_, | ||
pk=id_, | ||
created_at=now_, | ||
last_updated_at=now_, | ||
state=ScheduledEmailStatus.SCHEDULED, | ||
scheduled_at=now_, | ||
to_header=["[email protected]"], | ||
to_header_context_json="[]", | ||
to_header_context_json=[], | ||
to_header_rendered=["[email protected]"], | ||
from_header="[email protected]", | ||
reply_to_header="[email protected]", | ||
|
@@ -164,8 +164,8 @@ async def test_send_email__outgoing_addresses_overwritten() -> None: | |
subject_rendered="Hello World and John Doe!", | ||
body="Welcome, {{ name }}!", | ||
body_rendered="Welcome, John Doe!", | ||
context_json="{}", | ||
template_id=id_, | ||
context_json={}, | ||
template="Welcome email", | ||
) | ||
credentials = MailgunCredentials( | ||
MAILGUN_SENDER_DOMAIN="example.com", | ||
|
Oops, something went wrong.