'get_image_dimensions() should return (None, None) for the dimensions of
invalid images (#24441).
brokenimg.png is not a valid image and it has been generated by:
$ echo "123" > brokenimg.png'

def test_invalid_image(self):

    img_path = os.path.join(os.path.dirname(__file__), 'brokenimg.png')
    with open(img_path, 'rb') as fh:
        size = images.get_image_dimensions(fh)
        self.assertEqual(size, (None, None))
