Ejemplo n.º 1
0
def test_create_message_metrics(job_mock, template):
    job_mock.metrics = dict(users=15, pageviews=25, applications=3)
    message = create_message(job_mock, template, date.today())
    html = message['html_content']

    assert '<b>15</b>' in html
    assert '<b>25</b>' in html
Ejemplo n.º 2
0
def test_create_message_expires_soon(job_mock, template):
    job_mock.expires_at = date(2020, 7, 1)
    message = create_message(job_mock, template, date(2020, 6, 24))
    html = message['html_content']

    assert 'prodloužit o dalších 30&nbsp;dní' in html
    assert 'https://junior.guru/hire-juniors/#pricing' in html
Ejemplo n.º 3
0
def test_create_message_applications_non_zero(job_mock, template):
    job_mock.metrics = dict(users=15, pageviews=25, applications=5)
    message = create_message(job_mock, template, date(2020, 6, 23))
    html = message['html_content']

    assert 'uchazeč' in html
    assert '<b>5</b>' in html
Ejemplo n.º 4
0
def test_create_message_no_newsletter_mentions(job_mock, template):
    job_mock.newsletter_mentions = []
    message = create_message(job_mock, template, date.today())
    html = message['html_content']

    assert 'zatím NE' in html
    assert 'odeslán' not in html
    assert 'archiv' in html
    assert 'campaign-archive.com' in html
Ejemplo n.º 5
0
def test_create_message_start_end(job_mock, template):
    job_mock.posted_at = date(2020, 6, 1)
    job_mock.expires_at = date(2020, 7, 1)
    message = create_message(job_mock, template, date(2020, 6, 23))
    html = message['html_content']

    assert '22&nbsp;dní' in html
    assert 'schválen 1.6.2020' in html
    assert '8&nbsp;dní' in html
    assert 'vyprší 1.7.2020' in html
Ejemplo n.º 6
0
def test_create_message_expires_soon_annual_flat_rate(job_mock, template):
    job_mock.expires_at = date(2020, 7, 1)
    job_mock.pricing_plan = 'annual_flat_rate'
    message = create_message(job_mock, template, date(2020, 6, 26))
    html = message['html_content']

    assert 'paušál' in html
    assert 'ZDARMA' in html
    assert 'komunit' not in html
    assert 'https://junior.guru/hire-juniors/#pricing' in html
Ejemplo n.º 7
0
def test_create_message_expires_soon_standard(job_mock, template):
    job_mock.expires_at = date(2020, 7, 1)
    job_mock.pricing_plan = 'standard'
    message = create_message(job_mock, template, date(2020, 6, 26))
    html = message['html_content']

    assert '500&nbsp;Kč' in html
    assert 'paušál' not in html
    assert 'komunit' not in html
    assert 'https://junior.guru/hire-juniors/#pricing' in html
Ejemplo n.º 8
0
def test_create_message_newsletter_mentions(job_mock, template):
    job_mock.newsletter_mentions = [
        JobNewsletterMention(job=job_mock, sent_at=date(2020, 2, 1), link='https://example.com/newsletter/1'),
        JobNewsletterMention(job=job_mock, sent_at=date(2020, 4, 1), link='https://example.com/newsletter/3'),
        JobNewsletterMention(job=job_mock, sent_at=date(2020, 3, 1), link='https://example.com/newsletter/2'),
    ]
    message = create_message(job_mock, template, date(2020, 6, 23))
    html = message['html_content']

    assert 'ANO' in html
    assert 'odeslán' in html
    assert '<a href="https://example.com/newsletter/1">1.2.</a>' in html
    assert '<a href="https://example.com/newsletter/2">1.3.</a>' in html
    assert '<a href="https://example.com/newsletter/3">1.4.</a>' in html
    assert 'archiv' in html
    assert 'campaign-archive.com' in html
Ejemplo n.º 9
0
def test_create_message_subject(job_mock, template, expires_at, expected):
    job_mock.expires_at = expires_at
    message = create_message(job_mock, template, date(2020, 6, 20))

    assert message['subject'] == expected
Ejemplo n.º 10
0
def test_create_message_prefill_form(job_mock, template):
    job_mock.company_name = 'Honza Ltd.'
    message = create_message(job_mock, template, date.today())
    html = message['html_content']

    assert '&entry.681099058=Honza+Ltd.' in html
Ejemplo n.º 11
0
def test_create_message_expires_not_soon(job_mock, template):
    job_mock.expires_at = date(2020, 7, 1)
    message = create_message(job_mock, template, date(2020, 6, 20))
    html = message['html_content']

    assert 'prodloužit o dalších 30&nbsp;dní' not in html