diff options
| author | 2021-02-03 19:17:50 -0500 | |
|---|---|---|
| committer | 2021-02-03 19:17:50 -0500 | |
| commit | 475d074fd74425efbe783fad08f97f2df0c4909f (patch) | |
| tree | 2acdae53999b3c74b716efa4edb5b40311fa356a /tests/integration/test_empty_build.py | |
| parent | cd502d52787f666fff3254d7d7e7578930c813c2 (diff) | |
| parent | 3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 (diff) | |
Update upstream source from tag 'upstream/8.1.2'
Update to upstream version '8.1.2'
with Debian dir e5e966a9e6010ef70618dc9a61558fa4db35aceb
Diffstat (limited to 'tests/integration/test_empty_build.py')
| -rw-r--r-- | tests/integration/test_empty_build.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/integration/test_empty_build.py b/tests/integration/test_empty_build.py new file mode 100644 index 0000000..a21bf73 --- /dev/null +++ b/tests/integration/test_empty_build.py @@ -0,0 +1,54 @@ +"""Performaning the build of an empty site.""" + +import io +import os + +import pytest + +import nikola.plugins.command.init +from nikola import __main__ + +from .helper import cd + + +def test_check_links(build, target_dir): + with cd(target_dir): + assert __main__.main(["check", "-l"]) is None + + +def test_check_files(build, target_dir): + with cd(target_dir): + assert __main__.main(["check", "-f"]) is None + + +def test_index_in_sitemap(build, output_dir): + sitemap_path = os.path.join(output_dir, "sitemap.xml") + with io.open(sitemap_path, "r", encoding="utf8") as inf: + sitemap_data = inf.read() + + assert "<loc>https://example.com/</loc>" in sitemap_data + + +def test_avoid_double_slash_in_rss(build, output_dir): + rss_path = os.path.join(output_dir, "rss.xml") + with io.open(rss_path, "r", encoding="utf8") as inf: + rss_data = inf.read() + + assert "https://example.com//" not in rss_data + + +def test_archive_exists(build, output_dir): + """Ensure the build did something.""" + index_path = os.path.join(output_dir, "archive.html") + assert os.path.isfile(index_path) + + +@pytest.fixture(scope="module") +def build(target_dir): + """Build the site.""" + init_command = nikola.plugins.command.init.CommandInit() + init_command.create_empty_site(target_dir) + init_command.create_configuration(target_dir) + + with cd(target_dir): + __main__.main(["build"]) |
