Skip to content

Commit

Permalink
server/emails: add test for PledgerPledgePendingNotification
Browse files Browse the repository at this point in the history
  • Loading branch information
zegl committed May 25, 2023
1 parent 6dd3c44 commit fadfce1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,5 @@ dmypy.json

# Playground file
playground.py

.DS_Store
6 changes: 4 additions & 2 deletions server/polar/notifications/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def body(self) -> str:
""" # noqa: E501


# TODO: needs new copy!
class MaintainerPledgePaidNotification(NotificationBase):
pledge_amount: str
paid_out_amount: str
Expand All @@ -103,10 +104,11 @@ def body(self) -> str:

class PledgerPledgePendingNotification(NotificationBase):
pledge_amount: str
paid_out_amount: str
issue_url: str
issue_title: str
repo_owner: str
issue_number: int
issue_org_name: str
issue_repo_name: str
pledge_date: str

def subject(self) -> str:
Expand Down
18 changes: 18 additions & 0 deletions server/tests/notifications/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from polar.notifications.notification import (
MaintainerPledgeCreatedNotification,
MaintainerPledgePendingNotification,
PledgerPledgePendingNotification,
)
import inspect

Expand Down Expand Up @@ -98,3 +99,20 @@ async def test_MaintainerPledgePendingdNotification_with_stripe(
)

await check_diff(n.render(predictable_user))


@pytest.mark.asyncio
async def test_PledgerPledgePendingNotification(
predictable_user: User,
) -> None:
n = PledgerPledgePendingNotification(
issue_url="https://github.com/testorg/testrepo/issues/123",
issue_title="issue title",
issue_number=123,
pledge_amount="123.45",
issue_org_name="testorg",
issue_repo_name="testrepo",
pledge_date="2023-02-02",
)

await check_diff(n.render(predictable_user))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testorg/testrepo#123 is completed
<hr>
Hi,<br><br>

Good news: <a href="https://github.com/testorg/testrepo/issues/123">testorg/testrepo#123</a> has been completed! You pledged $123.45 behind it on 2023-02-02. It will be rewarded to the creators in 14 days unless you file a dispute via email or the Polar dashboard within the next 7 days.

0 comments on commit fadfce1

Please sign in to comment.