@@ -139,6 +139,16 @@ def test_format_inline_images_with_img_tag(self):
139139
140140 self .assertStartsWith (output_email ['body' ], '<div><h3>test image</h3><img src="data:image/png;' )
141141
142+ @mock_responses .activate
143+ def test_format_inline_images_with_query_string (self ):
144+ url = 'http://test-url.png?foo=bar&baz=qux'
145+ self .givenTestImage (url = url , content_type = '' )
146+ input_email = {'body' : f'<div><h3>test image</h3><img src="{ url } "/></div>' }
147+
148+ output_email = email_parser .format_inline_images (input_email , self .fail_if_called )
149+
150+ self .assertStartsWith (output_email ['body' ], '<div><h3>test image</h3><img src="data:image/png;' )
151+
142152 @mock_responses .activate
143153 @patch .object (email_parser , 'Image' )
144154 def test_handles_exceptions_when_processing_image (self , mock_pil ):
@@ -213,13 +223,13 @@ def assertHasCount(self, data, snippet, expected_count):
213223 f'times but got { actual_count } ' )
214224
215225 @classmethod
216- def givenTestImage (cls , content_type = 'image/png' , status = 200 ):
226+ def givenTestImage (cls , content_type = 'image/png' , status = 200 , url = 'http://test-url.png' ):
217227 with open (join (TEST_DATA_DIRECTORY , 'test_image.png' ), 'rb' ) as image :
218228 image_bytes = image .read ()
219229
220230 mock_responses .add (
221231 mock_responses .GET ,
222- 'http://test- url.png' ,
232+ url ,
223233 content_type = content_type ,
224234 body = image_bytes ,
225235 status = status ,
0 commit comments