Exemple #1
0
def test_makes_links_out_of_URLs(url):
    link = '<a style="word-wrap: break-word;" href="{}">{}</a>'.format(
        url, url)
    assert (notify_email_markdown(url) == (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        '{}'
        '</p>').format(link))
def test_add_spaces_after_single_newlines_so_markdown_converts_them():
    converted = prepare_newlines_for_markdown(
        'Paragraph one\n'
        '\n'
        'Paragraph two has linebreaks\n'
        'This is the second line\n'
        'The third has 2 spaces after it  \n'
        'And this is the fourth\n'
        '\n'
        'Next paragraph')
    assert converted == ('Paragraph one\n'
                         '\n'
                         'Paragraph two has linebreaks  \n'
                         'This is the second line  \n'
                         'The third has 2 spaces after it  \n'
                         'And this is the fourth\n'
                         '\n'
                         'Next paragraph')
    assert notify_email_markdown(converted) == (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        'Paragraph one'
        '</p>'
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        'Paragraph two has linebreaks<br/>'
        'This is the second line<br/>'
        'The third has 2 spaces after it<br/>'
        'And this is the fourth'
        '</p>'
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        'Next paragraph'
        '</p>')
Exemple #3
0
def test_URLs_get_escaped(url, expected_html, expected_html_in_template):
    assert notify_email_markdown(url) == (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        '{}'
        '</p>'
    ).format(expected_html)
    assert expected_html_in_template in str(HTMLEmailTemplate({'content': url, 'subject': ''}))
def test_urls_get_escaped(url, expected_html, expected_html_in_template):
    assert notify_email_markdown(url) == (PARAGRAPH_TEXT).format(expected_html)
    assert expected_html_in_template in str(
        HTMLEmailTemplate({
            'content': url,
            'subject': ''
        }))
Exemple #5
0
def test_handles_placeholders_in_urls():
    assert notify_email_markdown(
        "http://example.com/?token=<span class='placeholder'>((token))</span>&key=1"
    ) == (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        '<a style="word-wrap: break-word;" href="http://example.com/?token=">'
        'http://example.com/?token='
        '</a>'
        '<span class=\'placeholder\'>((token))</span>&amp;key=1'
        '</p>')
def test_preserves_whitespace_when_making_links():
    assert (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        '<a style="word-wrap: break-word;" href="https://example.com">'
        'https://example.com'
        '</a>'
        '</p>'
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        'Next paragraph'
        '</p>') == notify_email_markdown('https://example.com\n'
                                         '\n'
                                         'Next paragraph')
Exemple #7
0
def test_doesnt_make_links_out_of_invalid_urls(url):
    assert notify_email_markdown(url) == (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        '{}'
        '</p>').format(url)
Exemple #8
0
def test_makes_links_out_of_URLs_in_context(input, output):
    assert notify_email_markdown(input) == (
        '<p style="Margin: 0 0 20px 0; font-size: 19px; line-height: 25px; color: #0B0C0C;">'
        '{}'
        '</p>').format(output)
def test_doesnt_make_links_out_of_invalid_urls(url):
    assert notify_email_markdown(url) == (PARAGRAPH_TEXT).format(url)
def test_makes_links_out_of_urls_in_context(input, output):
    assert notify_email_markdown(input) == (PARAGRAPH_TEXT).format(output)
def test_makes_links_out_of_urls(url):
    link = '<a style="word-wrap: break-word; color: #004795;" href="{}">{}</a>'.format(
        url, url)
    assert (notify_email_markdown(url) == (PARAGRAPH_TEXT).format(link))