Exemplo n.º 1
0
def test_child_page_unroutable():
    """
    Child page should not provide a URL if it unroutable
    """
    home_page = HomePageFactory.create()
    child_page = TextSectionFactory.create(parent=home_page)
    assert not child_page.get_full_url()
Exemplo n.º 2
0
def test_course_program_child_view(client, wagtail_basics):
    """
    Test that course/program child pages show a 404
    """
    child_page = TextSectionFactory.create(parent=wagtail_basics.root)
    child_page.save_revision().publish()
    resp = client.get(child_page.get_url())
    assert resp.status_code == status.HTTP_404_NOT_FOUND
Exemplo n.º 3
0
def test_external_program_page_propel_career():
    """
    The propel_career property should return expected values if associated with a ExternalProgramPage
    """
    external_program_page = ExternalProgramPageFactory.create()
    propel_career_page = TextSectionFactory.create(
        parent=external_program_page,
        content="<p>content</p>",
        dark_theme=True,
        action_title="Action Title",
    )
    assert external_program_page.propel_career == propel_career_page
    assert propel_career_page.action_title == "Action Title"
    assert propel_career_page.content == "<p>content</p>"
    assert propel_career_page.dark_theme
Exemplo n.º 4
0
def test_course_page_propel_career():
    """
    The propel_career property should return expected values if associated with a CoursePage
    """
    course_page = CoursePageFactory.create()
    propel_career_page = TextSectionFactory.create(
        parent=course_page,
        content="<p>content</p>",
        dark_theme=True,
        action_title="Action Title",
    )
    assert course_page.propel_career == propel_career_page
    assert propel_career_page.action_title == "Action Title"
    assert propel_career_page.action_url
    assert propel_career_page.content == "<p>content</p>"
    assert propel_career_page.dark_theme
Exemplo n.º 5
0
def test_course_page_child_page_url():
    """
    The live URL of child pages should be of the correct format:
    <site_root>/courses/<course__readable_id>/<child_page__slug>
    """
    course_page = CoursePageFactory.create(course__readable_id="course:test")
    child_page = TextSectionFactory.create(parent=course_page)

    course_page_url = course_page.get_full_url()
    child_page_url = child_page.get_full_url()

    if WAGTAIL_APPEND_SLASH:
        assert child_page_url == "{}{}/".format(course_page_url,
                                                child_page.slug)
    else:
        assert child_page_url == "{}/{}".format(course_page_url,
                                                child_page.slug)
Exemplo n.º 6
0
def test_program_page_child_page_url():
    """
    The live URL of child pages should be of the correct format:
    <site_root>/programs/<program__readable_id>/<child_page__slug>
    """
    program_page = ProgramPageFactory.create(
        program__readable_id="program:test")
    child_page = TextSectionFactory.create(parent=program_page)

    program_page_url = program_page.get_full_url()
    child_page_url = child_page.get_full_url()

    if WAGTAIL_APPEND_SLASH:
        assert child_page_url == "{}{}/".format(program_page_url,
                                                child_page.slug)
    else:
        assert child_page_url == "{}/{}".format(program_page_url,
                                                child_page.slug)