コード例 #1
0
def test_get_html_content_renders_singular_for_single_brief():
    html_content = get_html_content(ONE_BRIEF, 1)["html"]
    doc = html.fromstring(html_content)
    brief_titles = doc.xpath('//*[@class="opportunity-title"]')

    assert "1 new digital specialists opportunity was published" in html_content
    assert "View and apply for this opportunity:" in html_content

    assert len(brief_titles) == 1
    assert brief_titles[0].text_content() == "Brief 1"
コード例 #2
0
def test_get_html_content_renders_multiple_briefs():
    html_content = get_html_content(MANY_BRIEFS, 1)["html"]
    doc = html.fromstring(html_content)
    brief_titles = doc.xpath('//*[@class="opportunity-title"]')

    assert "2 new digital specialists opportunities were published" in html_content
    assert "View and apply for these opportunities:" in html_content

    assert len(brief_titles) == 2
    assert brief_titles[0].text_content() == "Brief 1"
    assert brief_titles[1].text_content() == "Brief 2"
コード例 #3
0
def test_get_html_content_renders_brief_information():
    with freeze_time('2017-04-19 08:00:00'):
        html_content = get_html_content(ONE_BRIEF, 1)["html"]
        doc = html.fromstring(html_content)

        assert doc.xpath('//*[@class="opportunity-title"]')[0].text_content(
        ) == ONE_BRIEF[0]["title"]
        assert doc.xpath('//*[@class="opportunity-organisation"]'
                         )[0].text_content() == ONE_BRIEF[0]["organisation"]
        assert doc.xpath('//*[@class="opportunity-location"]')[0].text_content(
        ) == ONE_BRIEF[0]["location"]
        assert doc.xpath('//*[@class="opportunity-closing"]')[0].text_content(
        ) == "Closing Tuesday 5 July 2016"
        assert doc.xpath('//a[@class="opportunity-link"]')[0].text_content(
        ) == "https://www.digitalmarketplace.service.gov.uk/digital-outcomes-and-specialists/opportunities/234?utm_id=20170419"  # noqa
コード例 #4
0
def test_get_html_content_with_briefs_from_several_days():
    with freeze_time('2017-04-17 08:00:00'):
        html_content = get_html_content(ONE_BRIEF, 3)["html"]
        assert "Since Friday" in html_content
コード例 #5
0
def test_get_html_content_with_briefs_from_last_day():
    html_content = get_html_content(ONE_BRIEF, 1)["html"]
    assert "In the last day" in html_content
コード例 #6
0
 def test_get_html_content_with_briefs_from_last_day(self):
     html_content = get_html_content([BRIEF_1], 1)["html"]
     assert "In the last day" in html_content