diff options
| author | 2021-02-03 19:17:00 -0500 | |
|---|---|---|
| committer | 2021-02-03 19:17:00 -0500 | |
| commit | 3a0d66f07b112b6d2bdc2b57bbf717a89a351ce6 (patch) | |
| tree | a7cf56282e54f05785243bc1e903d6594f2c06ba /tests/integration/test_translated_content_secondary_language.py | |
| parent | 787b97a4cb24330b36f11297c6d3a7a473a907d0 (diff) | |
New upstream version 8.1.2.upstream/8.1.2
Diffstat (limited to 'tests/integration/test_translated_content_secondary_language.py')
| -rw-r--r-- | tests/integration/test_translated_content_secondary_language.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/integration/test_translated_content_secondary_language.py b/tests/integration/test_translated_content_secondary_language.py new file mode 100644 index 0000000..f826d1d --- /dev/null +++ b/tests/integration/test_translated_content_secondary_language.py @@ -0,0 +1,40 @@ +"""Make sure posts only in secondary languages work.""" + +import os +import shutil + +import pytest + +import nikola.plugins.command.init +from nikola import __main__ + +from .helper import cd +from .test_empty_build import ( # NOQA + test_archive_exists, + test_avoid_double_slash_in_rss, + test_check_files, + test_check_links, + test_index_in_sitemap, +) + + +@pytest.fixture(scope="module") +def build(target_dir, test_dir): + """Build the site.""" + init_command = nikola.plugins.command.init.CommandInit() + init_command.create_empty_site(target_dir) + init_command.create_configuration(target_dir) + + src = os.path.join(test_dir, "..", "data", "translated_titles") + for root, dirs, files in os.walk(src): + for src_name in files: + if src_name == "1.txt": # English post + continue + + rel_dir = os.path.relpath(root, src) + dst_file = os.path.join(target_dir, rel_dir, src_name) + src_file = os.path.join(root, src_name) + shutil.copy2(src_file, dst_file) + + with cd(target_dir): + __main__.main(["build"]) |
