def test_markdown_features_and_readme_generation() -> None: # given & when index_title = 'Markdown Feature Test without "quotes bug"' index_raw_title = 'Markdown Feature Test without "quotes bug"' canonical_url = 'https://oliz.io/ggpy/test/features/' index_data = read_file('test/features/index.html') # then index_data = then_is_framed_by_html_boilerplate(index_data) index_data = then_has_bottom_navigation_and_social_links(index_data) index_data = then_has_title_canonical_and_favicon( index_data, title=f'{index_title} | {SITE_TITLE}', canonical_url=canonical_url, favicon_url=LOGO_URL ) index_data = then_has_style(index_data) index_data = then_head_ends_with_meta_tags( index_data, title=index_title, raw_title=index_raw_title, description=index_title, raw_description=index_raw_title, canonical_url=canonical_url, creation_time='1996-06-06T13:37:42Z' ) index_data = then_has_body(index_data) assert GENERATED_FEATURE_HTML == index_data
def test_post_conversion() -> None: # given & when post_title = 'Some Post' description = 'Nice post!' canonical_url = 'https://oliz.io/ggpy/test/some-post.html' post_data = read_file('test/some-post.html') # then post_data = then_is_framed_by_html_boilerplate(post_data) post_data = then_has_bottom_navigation_and_social_links(post_data) post_data = then_has_title_canonical_and_favicon( post_data, title=f'{post_title} | {SITE_TITLE}', canonical_url=canonical_url, favicon_url=LOGO_URL ) post_data = then_has_style(post_data) post_data = then_head_ends_with_meta_tags( post_data, title=post_title, raw_title=post_title, description=description, raw_description=description, canonical_url=canonical_url, creation_time='2018-03-17T13:37:42Z' ) post_data = then_has_body(post_data) assert GENERATED_POST_HTML == post_data
def test_sitemap_generation() -> None: sitemap_data = read_file('sitemap.xml') assert re.match(r'''<\?xml version="1.0" encoding="utf-8" standalone="yes" \?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>https://oliz.io/ggpy/</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/CHANGELOG.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/features/</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/features/index-inline-posts/little-inline-content-no-description.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/features/index-inline-posts/lots-of-content-no-description.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/features/index-inline-posts/lots-of-content-with-description.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/features/index-inline-posts/no-content-with-description.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/features/meta.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> <url> <loc>https://oliz.io/ggpy/test/some-post.html</loc> <lastmod>[\d\-]{10}</lastmod> </url> </urlset> ''', sitemap_data)
def test_rss_generation() -> None: rss = read_file('rss.xml') assert rss.startswith('''<?xml version="1.0" encoding="utf-8" standalone="yes"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel>''') assert rss.endswith('''</rss>\n''')
def test_sitemap_does_not_include_drafts() -> None: sitemap_data = read_file('sitemap.xml') assert 'draft-not-included-in-sitemap' not in sitemap_data
def test_omit_machine_readable_meta_when_no_meta_tag_is_set() -> None: rendered = read_file('test/features/no-meta.html') then_no_meta_is_present(rendered)
def test_minimal_page_with_all_skip_tags_combined() -> None: rendered = read_file('test/features/minimal.html') then_no_meta_is_present(rendered) then_no_header_is_present(rendered) then_no_footer_is_present(rendered)
def test_omit_page_footer_when_no_footer_tag_is_set() -> None: rendered = read_file('test/features/no-footer/index.html') assert '<header>' in rendered then_no_footer_is_present(rendered)
def test_omit_page_header_when_no_header_tag_is_set() -> None: rendered = read_file('test/features/no-header.html') then_no_header_is_present(rendered) assert '<footer>' in rendered