예제 #1
0
    def test_purge_delete_images(self):
        """
        If there are any custom-generated images for a user's banner instances,
        they must be deleted.
        """
        user = FacebookUserFactory.create()
        instance = FacebookBannerInstanceFactory.create(user=user)
        with open(path('images', 'banner.png')) as banner:
            instance.custom_image.save('custom.png', File(banner))
        file_path = ''.join((settings.MEDIA_ROOT, instance.custom_image.name))

        self.manager.purge_user_data(user)
        ok_(not os.path.exists(file_path))
예제 #2
0
    def test_purge_delete_images(self):
        """
        If there are any custom-generated images for a user's banner instances,
        they must be deleted.
        """
        user = FacebookUserFactory.create()
        instance = FacebookBannerInstanceFactory.create(user=user)
        with open(path('images', 'banner.png')) as banner:
            instance.custom_image.save('custom.png', File(banner))
        file_path = ''.join((settings.MEDIA_ROOT, instance.custom_image.name))

        self.manager.purge_user_data(user)
        ok_(not os.path.exists(file_path))
예제 #3
0
def image_response(*image_path):
    """Return a mock Requests response with an image as the content."""
    response = requests.Response()
    with open(path(*image_path), 'rb') as image_file:
        response._content = image_file.read()
    return lambda url: response
예제 #4
0
def image_response(*image_path):
    """Return a mock Requests response with an image as the content."""
    response = requests.Response()
    with open(path(*image_path), 'rb') as image_file:
        response._content = image_file.read()
    return lambda url: response