Esempio n. 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')
Esempio n. 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')
Esempio n. 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')
Esempio n. 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
Esempio n. 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
Esempio n. 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
Esempio n. 7
0
 def setup(self):
     self.fs = GridFSStorage('mongodb://localhost/gridfs_example', 'testfs')
Esempio n. 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')