コード例 #1
0
def test_404_links(settings):
    """Test 404 page has links to home and contact-us."""
    context = context_processors.urls_processor(None)
    html = render_to_string('404.html', context)

    assert urls.domestic.HOME in html
    assert urls.domestic.CONTACT_US in html
コード例 #2
0
def test_urls_exist_in_domestic_header(url, settings):
    context = {
        'features': {'NEWS_SECTION_ON': True},
        **context_processors.header_footer_processor(None),
        **context_processors.urls_processor(None)
    }
    template_name = (
        'great_components/header_footer/domestic_header.html')
    assert url in render_to_string(template_name, context)
コード例 #3
0
def test_header_international_news_section_off(settings):
    context = {
        'features': {'NEWS_SECTION_ON': False},
        **context_processors.header_footer_processor(None),
        **context_processors.urls_processor(None)
    }
    template_name = 'great_components/header_footer/domestic_header.html'
    html = render_to_string(template_name, context)
    assert urls.international.NEWS not in html
コード例 #4
0
def test_urls_exist_in_international_footer(url, settings):
    context = {
        **context_processors.header_footer_processor(None),
        **context_processors.urls_processor(None),
        **context_processors.feature_flags(None),
    }
    template_name = (
        'great_components/header_footer/international_footer.html')
    assert url in render_to_string(template_name, context)
コード例 #5
0
def test_domestic_footer_ids_match_urls_and_text(
    title, element_id, url, settings
):
    context = {
        **context_processors.header_footer_processor(None),
        **context_processors.urls_processor(None),
        **context_processors.feature_flags(None),
    }
    html = render_to_string(
        'great_components/header_footer/domestic_footer.html', context
    )
    soup = BeautifulSoup(html, 'html.parser')

    element = soup.find(id=element_id)
    assert element.attrs['href'] == url
    if title:
        assert element.string == title
コード例 #6
0
def test_urls_processor(settings):

    context = context_processors.urls_processor(None)

    assert context['services_urls'] == {
        'contact_us': 'https://exred.com/contact/',
        'events': 'https://events.com',
        'exopps': 'https://exopps.com',
        'exred': 'https://exred.com',
        'fab': 'https://fab.com',
        'fas': 'https://international.com/international/trade/',
        'feedback': 'https://exred.com/contact/feedback/',
        'great_domestic': 'https://exred.com',
        'great_international': 'https://international.com/international/',
        'invest': 'https://international.com/international/invest/',
        'soo': 'https://soo.com',
        'sso': 'https://sso.com',
        'uk_setup_guide':
        'https://international.com/international/content/how-to-setup-in-the-uk/',
        'isd':
        'https://international.com/international/investment-support-directory/',
        'office_finder': 'https://exred.com/contact/office-finder/',
    }
コード例 #7
0
def test_404_title_exists(settings):
    context = context_processors.urls_processor(None)
    html = render_to_string('404.html', context)
    soup = BeautifulSoup(html, 'html.parser')
    title = soup.title.string
    assert len(title) > 0
コード例 #8
0
def test_404_content(settings):
    """Test 404 page has correct content."""
    context = context_processors.urls_processor(None)
    html = render_to_string('404.html', context)

    assert 'If you entered a web address please check it’s correct.' in html
コード例 #9
0
def test_base_page_links(settings):
    context = context_processors.urls_processor(None)
    html = render_to_string('great_components/base.html', context)

    assert urls.domestic.FEEDBACK in html