40 lines
804 B
Python
40 lines
804 B
Python
from uuid import uuid4
|
|
|
|
from storage.basestorage import Storage
|
|
|
|
|
|
class FakeStorage(Storage):
|
|
def _init_path(self, path=None, create=False):
|
|
return path
|
|
|
|
def get_content(self, path):
|
|
raise IOError('Fake files are fake!')
|
|
|
|
def put_content(self, path, content):
|
|
return path
|
|
|
|
def stream_read(self, path):
|
|
yield ''
|
|
|
|
def stream_write(self, path, fp):
|
|
pass
|
|
|
|
def remove(self, path):
|
|
pass
|
|
|
|
def exists(self, path):
|
|
return False
|
|
|
|
|
|
class FakeUserfiles(object):
|
|
def prepare_for_drop(self, mime_type):
|
|
return ('http://fake/url', uuid4())
|
|
|
|
def store_file(self, file_like_obj, content_type):
|
|
raise NotImplementedError()
|
|
|
|
def get_file_url(self, file_id, expires_in=300):
|
|
return ('http://fake/url')
|
|
|
|
def get_file_checksum(self, file_id):
|
|
return 'abcdefg'
|