'If exist is True, make sure the images physically exist in storage
with correct sizes and formats.
If exist is False, make sure none of the images exist.'

def check_images(self, user, storage, exist=True):

    for (size, name) in get_profile_image_names(user.username).items():
        if exist:
            self.assertTrue(storage.exists(name))
            with closing(Image.open(storage.path(name))) as img:
                self.assertEqual(img.size, (size, size))
                self.assertEqual(img.format, u'JPEG')
        else:
            self.assertFalse(storage.exists(name))
