예제 #1
0
def test_substitution_data():
    email_message = EmailMessage(
        to=[
            {
                "address": "*****@*****.**",
                "substitution_data": {
                    "key": "value"
                }
            }
        ],
        from_email='*****@*****.**'
    )
    email_message.template = 'template-id'
    email_message.substitution_data = {"key2": "value2"}
    actual = SparkPostMessage(email_message)

    expected = dict(
        recipients=[
            {
                "address": "*****@*****.**",
                "substitution_data": {
                    "key": "value"
                }
            }
        ],
        from_email='*****@*****.**',
        template='template-id',
        substitution_data={"key2": "value2"}
    )

    assert actual == expected
예제 #2
0
def test_template():
    email_message = EmailMessage(to=['*****@*****.**'],
                                 from_email='*****@*****.**')
    email_message.template = 'template-id'
    actual = SparkPostMessage(email_message)
    expected = dict(recipients=['*****@*****.**'],
                    from_email='*****@*****.**',
                    template='template-id')
    assert actual == expected
예제 #3
0
def test_template():
    email_message = EmailMessage(
        to=['*****@*****.**'],
        from_email='*****@*****.**'
    )
    email_message.template = 'template-id'
    actual = SparkPostMessage(email_message)
    expected = dict(
        recipients=['*****@*****.**'],
        from_email='*****@*****.**',
        template='template-id'
    )
    assert actual == expected
예제 #4
0
def test_substitution_data():
    email_message = EmailMessage(to=[{
        "address": "*****@*****.**",
        "substitution_data": {
            "key": "value"
        }
    }],
                                 from_email='*****@*****.**')
    email_message.template = 'template-id'
    email_message.substitution_data = {"key2": "value2"}
    actual = SparkPostMessage(email_message)

    expected = dict(recipients=[{
        "address": "*****@*****.**",
        "substitution_data": {
            "key": "value"
        }
    }],
                    from_email='*****@*****.**',
                    template='template-id',
                    substitution_data={"key2": "value2"})

    assert actual == expected