'Test that the file is actualy move from the private to the public
directory when the is_public is checked on an existing private file.'

def test_file_change_upload_to_destination(self):

    file_obj = DjangoFile(open(self.filename, u'rb'), name=self.image_name)
    image = Image.objects.create(owner=self.superuser, is_public=False, original_filename=self.image_name, file=file_obj)
    image.save()
    self.assertTrue(image.file.path.startswith(filer_settings.FILER_PRIVATEMEDIA_STORAGE.location))
    image.is_public = True
    image.save()
    self.assertTrue(image.file.path.startswith(filer_settings.FILER_PUBLICMEDIA_STORAGE.location))
    self.assertEqual(len(image.icons), len(filer_settings.FILER_ADMIN_ICON_SIZES))
    image.is_public = False
    image.save()
    self.assertTrue(image.file.path.startswith(filer_settings.FILER_PRIVATEMEDIA_STORAGE.location))
    self.assertEqual(len(image.icons), len(filer_settings.FILER_ADMIN_ICON_SIZES))
