-
Notifications
You must be signed in to change notification settings - Fork 70
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
Jose Zamora
committed
Aug 10, 2018
1 parent
e4cf55d
commit a55235b
Showing
2 changed files
with
44 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,34 +186,67 @@ def test_campaign(): | |
assert actual == expected | ||
|
||
|
||
def test_metadata(): | ||
email_message = EmailMessage( | ||
to=[ | ||
{ | ||
'address': '[email protected]', | ||
'metadata': { | ||
'key': 'value' | ||
} | ||
} | ||
], | ||
from_email='[email protected]' | ||
) | ||
email_message.template = 'template-id' | ||
email_message.metadata = {'key2': 'value2'} | ||
actual = SparkPostMessage(email_message) | ||
|
||
expected = dict( | ||
recipients=[ | ||
{ | ||
'address': '[email protected]', | ||
'metadata': { | ||
'key': 'value' | ||
} | ||
} | ||
], | ||
from_email='[email protected]', | ||
template='template-id', | ||
metadata={'key2': 'value2'} | ||
) | ||
|
||
assert actual == expected | ||
|
||
|
||
def test_substitution_data(): | ||
email_message = EmailMessage( | ||
to=[ | ||
{ | ||
"address": "[email protected]", | ||
"substitution_data": { | ||
"key": "value" | ||
'address': '[email protected]', | ||
'substitution_data': { | ||
'key': 'value' | ||
} | ||
} | ||
], | ||
from_email='[email protected]' | ||
) | ||
email_message.template = 'template-id' | ||
email_message.substitution_data = {"key2": "value2"} | ||
email_message.substitution_data = {'key2': 'value2'} | ||
actual = SparkPostMessage(email_message) | ||
|
||
expected = dict( | ||
recipients=[ | ||
{ | ||
"address": "[email protected]", | ||
"substitution_data": { | ||
"key": "value" | ||
'address': '[email protected]', | ||
'substitution_data': { | ||
'key': 'value' | ||
} | ||
} | ||
], | ||
from_email='[email protected]', | ||
template='template-id', | ||
substitution_data={"key2": "value2"} | ||
substitution_data={'key2': 'value2'} | ||
) | ||
|
||
assert actual == expected | ||
|