예제 #1
0
def test_md_output_with_body_text():
    """
    Given:
     - The input email_data with a value in the 'Text' field.

    When:
     - Running the data_to_md command on this email_data.

    Then:
     - Validate that the output md contains a row for the 'Text' field.
    """
    email_data = {
        'To': '*****@*****.**',
        'From': '*****@*****.**',
        'Text': '<email text>'
    }
    expected = u'### Results:\n' \
               u'* From:\[email protected]\n' \
               u'* To:\[email protected]\n' \
               u'* CC:\t\n' \
               u'* Subject:\t\n' \
               u'* Body/Text:\t[email text]\n' \
               u'* Attachments:\t\n\n\n' \
               u'### HeadersMap\n' \
               u'**No entries.**\n'

    md = data_to_md(email_data)
    assert expected == md
예제 #2
0
def test_md_output_empty_body_text():
    """
    Given:
     - The input email_data where the value of the 'Text' field is None.

    When:
     - Running the data_to_md command on this email_data.

    Then:
     - Validate that output the md doesn't contain a row for the 'Text' field.
    """
    email_data = {
        'To': '*****@*****.**',
        'From': '*****@*****.**',
        'Text': None
    }
    expected = u'### Results:\n' \
               u'* From:\[email protected]\n' \
               u'* To:\[email protected]\n' \
               u'* CC:\t\n' \
               u'* Subject:\t\n' \
               u'* Attachments:\t\n\n\n' \
               u'### HeadersMap\n' \
               u'**No entries.**\n'

    md = data_to_md(email_data)
    assert expected == md

    email_data = {
        'To': '*****@*****.**',
        'From': '*****@*****.**',
    }
    expected = u'### Results:\n' \
               u'* From:\[email protected]\n' \
               u'* To:\[email protected]\n' \
               u'* CC:\t\n' \
               u'* Subject:\t\n' \
               u'* Attachments:\t\n\n\n' \
               u'### HeadersMap\n' \
               u'**No entries.**\n'

    md = data_to_md(email_data)
    assert expected == md