def setup(self): try: import pymongo.errors self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs') except pymongo.errors.ConnectionFailure: raise SkipTest('MongoDB not running')
def setup(self): try: from depot.io.gridfs import GridFSStorage except ImportError: raise SkipTest('PyMongo not installed') self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs')
def setup(self): try: from depot.io.gridfs import GridFSStorage except ImportError: raise SkipTest('PyMongo not installed') import pymongo.errors try: self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs') except pymongo.errors.ConnectionFailure: raise SkipTest('MongoDB not running')
class TestGridFSFileStorage(object): def setup(self): self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs') def teardown(self): self.fs._db.drop_collection('testfs') def test_fileoutside_depot(self): fileid = self.fs._gridfs.put(FILE_CONTENT) f = self.fs.get(str(fileid)) assert f.read() == FILE_CONTENT
class TestGridFSFileStorage(object): def setup(self): try: import pymongo.errors self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs') except pymongo.errors.ConnectionFailure: raise SkipTest('MongoDB not running') def teardown(self): self.fs._db.drop_collection('testfs') def test_fileoutside_depot(self): fileid = self.fs._gridfs.put(FILE_CONTENT) f = self.fs.get(str(fileid)) assert f.read() == FILE_CONTENT
def setup(self): self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs')