@@ -110,40 +110,40 @@ def test_inline_images_referenced_by_path_relative_to_base_are_included_in_outpu
110110 assert_equal ([], result .messages )
111111
112112
113- def test_images_stored_outside_of_document_are_included_in_output ():
113+ def test_when_external_file_access_is_enabled_images_stored_outside_of_document_are_included_in_output ():
114114 with open (generate_test_path ("external-picture.docx" ), "rb" ) as fileobj :
115- result = mammoth .convert_to_html (fileobj = fileobj )
115+ result = mammoth .convert_to_html (fileobj = fileobj , external_file_access = True )
116116 assert_equal ("""<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=" /></p>""" , result .value )
117117 assert_equal ([], result .messages )
118118
119119
120- def test_warn_if_images_stored_outside_of_document_are_specified_when_passing_fileobj_without_name ():
120+ def test_when_external_file_access_is_enabled_warn_if_images_stored_outside_of_document_are_specified_when_passing_fileobj_without_name ():
121121 fileobj = io .BytesIO ()
122122 with open (generate_test_path ("external-picture.docx" ), "rb" ) as source_fileobj :
123123 shutil .copyfileobj (source_fileobj , fileobj )
124124
125- result = mammoth .convert_to_html (fileobj = fileobj )
125+ result = mammoth .convert_to_html (fileobj = fileobj , external_file_access = True )
126126 assert_equal ("" , result .value )
127127 assert_equal ([results .warning ("could not find external image 'tiny-picture.png', fileobj has no name" )], result .messages )
128128
129129
130- def test_warn_if_images_stored_outside_of_document_are_specified_when_external_file_access_is_disabled ():
130+ def test_given_external_file_access_is_disabled_by_default_then_warn_if_images_stored_outside_of_document_are_specified ():
131131 with open (generate_test_path ("external-picture.docx" ), "rb" ) as fileobj :
132- result = mammoth .convert_to_html (fileobj = fileobj , external_file_access = False )
132+ result = mammoth .convert_to_html (fileobj = fileobj )
133133
134134 assert_equal ("" , result .value )
135135 assert_equal ([results .warning ("could not open external image 'tiny-picture.png', external file access is disabled" )], result .messages )
136136
137137
138- def test_warn_if_images_stored_outside_of_document_are_not_found ():
138+ def test_when_external_file_access_is_enabled_warn_if_images_stored_outside_of_document_are_not_found ():
139139 with tempman .create_temp_dir () as temp_dir :
140140 document_path = os .path .join (temp_dir .path , "document.docx" )
141141 with open (document_path , "wb" ) as fileobj :
142142 with open (generate_test_path ("external-picture.docx" ), "rb" ) as source_fileobj :
143143 shutil .copyfileobj (source_fileobj , fileobj )
144144
145145 with open (document_path , "rb" ) as fileobj :
146- result = mammoth .convert_to_html (fileobj = fileobj )
146+ result = mammoth .convert_to_html (fileobj = fileobj , external_file_access = True )
147147 assert_equal ("" , result .value )
148148 expected_warning = "could not open external image: 'tiny-picture.png'"
149149 assert_equal ("warning" , result .messages [0 ].type )
0 commit comments