Пример #1
0
 def setup(self):
     try:
         import pymongo.errors
         self.fs = GridFSStorage('mongodb://localhost/gridfs_example',
                                 'testfs')
     except pymongo.errors.ConnectionFailure:
         raise SkipTest('MongoDB not running')
Пример #2
0
    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')
Пример #3
0
    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')
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
 def setup(self):
     self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs')
Пример #8
0
 def setup(self):
     try:
         import pymongo.errors
         self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs')
     except pymongo.errors.ConnectionFailure:
         raise SkipTest('MongoDB not running')