diff options
| author | Michael Williamson <mike@zwobble.org> | 2025-09-10 16:15:28 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2025-09-10 16:15:28 +0100 |
| commit | 150bf98e7ae2fd8ae874c3e756c39f01b3c01a23 (patch) | |
| tree | 22844fd319ceba4c54d4e95ddb6246fd2e9b17d2 /tests/mammoth_tests.py | |
| parent | 603f8b83c0389be91ca90a3cb7690d7f237699d8 (diff) | |
Support disabling external file access
Diffstat (limited to 'tests/mammoth_tests.py')
| -rw-r--r-- | tests/mammoth_tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py index 36d0e83..a7308f8 100644 --- a/tests/mammoth_tests.py +++ b/tests/mammoth_tests.py @@ -127,6 +127,14 @@ def test_warn_if_images_stored_outside_of_document_are_specified_when_passing_fi assert_equal([results.warning("could not find external image 'tiny-picture.png', fileobj has no name")], result.messages) +def test_warn_if_images_stored_outside_of_document_are_specified_when_external_file_access_is_disabled(): + with open(generate_test_path("external-picture.docx"), "rb") as fileobj: + result = mammoth.convert_to_html(fileobj=fileobj, external_file_access=False) + + assert_equal("", result.value) + assert_equal([results.warning("could not open external image 'tiny-picture.png', external file access is disabled")], result.messages) + + def test_warn_if_images_stored_outside_of_document_are_not_found(): with tempman.create_temp_dir() as temp_dir: document_path = os.path.join(temp_dir.path, "document.docx") |
