Ejemplo n.º 1
0
def test__index_missing() -> None:

    Globals.init(root=TestSites.index_missing)

    site = Site()

    with pytest.raises(SiteConfigError):
        site.build()
Ejemplo n.º 2
0
def test__config_menu_missing_page() -> None:

    Globals.init(root=TestSites.config_menu_missing_page)

    site = Site()

    with pytest.raises(SiteConfigError):
        site.build()
Ejemplo n.º 3
0
def test__config_menu_empty() -> None:

    Globals.init(root=TestSites.config_menu_empty)

    site = Site()
    site.build()

    assert site.menu == []
Ejemplo n.º 4
0
def test__valid() -> None:

    Globals.init(root=TestSites.valid)

    site = Site()
    site.build()

    repr(site)

    assert site.index is not None

    assert site.get_page("page-layout") is not None
    assert site.get_page("page-layout-gallery") is not None
    assert site.get_page("page-lazy") is not None
    assert site.get_page("page-lazy-gallery") is not None

    assert site.get_page("page-missing") is None

    assert site.config.title == "Testing Title"
    assert site.config.author == "Testing Author"
    assert site.config.copyright == "Testing Copyright"
    assert site.config.description == "Testing Description"
    assert site.config.favicon == "./testing-favicon.ico"

    assert site.config.header == {
        Key.TITLE: {
            Key.LABEL: "Testing Header Title Label",
            Key.IMAGE: "./testing-header-title-image.jpg",
        },
    }

    assert Globals.site_paths.static_url_path == "/site"
Ejemplo n.º 5
0
def test__rebuild_cache() -> None:

    Globals.init(root=TestSites.valid)

    site = Site()
    site.build()
    site.rebuild_cache()
Ejemplo n.º 6
0
def test__not_built() -> None:

    Globals.init(root=TestSites.valid)

    site = Site()

    with pytest.raises(Error):
        site.pages

    with pytest.raises(Error):
        site.menu

    with pytest.raises(Error):
        site.index