'Create image files with mocked-out storage.
Verifies that an image was created for each element in
requested_images, and returns an iterator of 2-tuples representing
those imageswhere each tuple consists of a filename and a PIL.Image
object.'

def _create_mocked_profile_images(self, image_file, requested_images):

    mock_storage = mock.Mock()
    with mock.patch('openedx.core.djangoapps.profile_images.images.get_profile_image_storage', return_value=mock_storage):
        create_profile_images(image_file, requested_images)
    names_and_files = [v[0] for v in mock_storage.save.call_args_list]
    self.assertEqual(len(names_and_files), len(requested_images))
    for (name, file_) in names_and_files:
        with closing(Image.open(file_)) as image:
            (yield (name, image))
