Skip to content

Commit

Permalink
Mailjet: update integration tests
Browse files Browse the repository at this point in the history
Mailjet deleted the Anymail testing account without notice.
Recreating the account changed the test template id. Move
the id to an environment variable to simplify changing it.
  • Loading branch information
medmunds committed Nov 22, 2024
1 parent 35383c7 commit a025ae9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ jobs:
ANYMAIL_TEST_MAILGUN_API_KEY: ${{ secrets.ANYMAIL_TEST_MAILGUN_API_KEY }}
ANYMAIL_TEST_MAILGUN_DOMAIN: ${{ secrets.ANYMAIL_TEST_MAILGUN_DOMAIN }}
ANYMAIL_TEST_MAILJET_API_KEY: ${{ secrets.ANYMAIL_TEST_MAILJET_API_KEY }}
ANYMAIL_TEST_MAILJET_DOMAIN: ${{ secrets.ANYMAIL_TEST_MAILJET_DOMAIN }}
ANYMAIL_TEST_MAILJET_DOMAIN: ${{ vars.ANYMAIL_TEST_MAILJET_DOMAIN }}
ANYMAIL_TEST_MAILJET_SECRET_KEY: ${{ secrets.ANYMAIL_TEST_MAILJET_SECRET_KEY }}
ANYMAIL_TEST_MAILJET_TEMPLATE_ID: ${{ vars.ANYMAIL_TEST_MAILJET_TEMPLATE_ID }}
ANYMAIL_TEST_MANDRILL_API_KEY: ${{ secrets.ANYMAIL_TEST_MANDRILL_API_KEY }}
ANYMAIL_TEST_MANDRILL_DOMAIN: ${{ secrets.ANYMAIL_TEST_MANDRILL_DOMAIN }}
ANYMAIL_TEST_POSTMARK_DOMAIN: ${{ secrets.ANYMAIL_TEST_POSTMARK_DOMAIN }}
Expand Down
8 changes: 7 additions & 1 deletion tests/test_mailjet_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ANYMAIL_TEST_MAILJET_API_KEY = os.getenv("ANYMAIL_TEST_MAILJET_API_KEY")
ANYMAIL_TEST_MAILJET_SECRET_KEY = os.getenv("ANYMAIL_TEST_MAILJET_SECRET_KEY")
ANYMAIL_TEST_MAILJET_DOMAIN = os.getenv("ANYMAIL_TEST_MAILJET_DOMAIN")
ANYMAIL_TEST_MAILJET_TEMPLATE_ID = os.getenv("ANYMAIL_TEST_MAILJET_TEMPLATE_ID")


@tag("mailjet", "live")
Expand Down Expand Up @@ -136,10 +137,15 @@ def test_merge_data(self):
self.assertEqual(recipient_status["[email protected]"].status, "sent")
self.assertEqual(recipient_status["[email protected]"].status, "sent")

@unittest.skipUnless(
ANYMAIL_TEST_MAILJET_TEMPLATE_ID,
"Set ANYMAIL_TEST_MAILJET_TEMPLATE_ID environment variable to run"
" Mailjet stored template integration test",
)
def test_stored_template(self):
message = AnymailMessage(
# ID of the real template named 'test-template' in our Mailjet test account:
template_id="176375",
template_id=ANYMAIL_TEST_MAILJET_TEMPLATE_ID,
to=["[email protected]"],
merge_data={
"[email protected]": {
Expand Down

0 comments on commit a025ae9

Please sign in to comment.