コード例 #1
0
ファイル: server_fuse_test.py プロジェクト: eliasmarkc/girder
    def testFilePath(self):
        """
        Test that all files report a FUSE path, and that this results in the
        same file as the non-fuse path.
        """
        from girder.plugins import fuse as girder_fuse

        files = list(File().find())
        for file in files:
            adapter = File().getAssetstoreAdapter(file)
            filesystempath = adapter.fullPath(file)
            filepath = girder_fuse.getFilePath(file)
            fusepath = girder_fuse.getFuseFilePath(file)
            self.assertTrue(os.path.exists(filesystempath))
            self.assertTrue(os.path.exists(filepath))
            self.assertTrue(os.path.exists(fusepath))
            self.assertEqual(filesystempath, filepath)
            self.assertNotEqual(filesystempath, fusepath)
            self.assertEqual(fusepath[:len(self.mainMountPath)],
                             self.mainMountPath)
            with open(filepath) as file1:
                with open(fusepath) as file2:
                    self.assertEqual(file1.read(), file2.read())
            subpath = fusepath[len(self.mainMountPath):].lstrip('/')
            if self.knownPaths.get(subpath):
                with open(fusepath) as file1:
                    self.assertEqual(file1.read().strip(),
                                     self.knownPaths[subpath])
コード例 #2
0
ファイル: server_fuse_test.py プロジェクト: satra/girder
    def testFilePath(self):
        """
        Test that all files report a FUSE path, and that this results in the
        same file as the non-fuse path.
        """
        from girder.plugins import fuse as girder_fuse

        files = list(File().find())
        for file in files:
            adapter = File().getAssetstoreAdapter(file)
            filesystempath = adapter.fullPath(file)
            filepath = girder_fuse.getFilePath(file)
            fusepath = girder_fuse.getFuseFilePath(file)
            self.assertTrue(os.path.exists(filesystempath))
            self.assertTrue(os.path.exists(filepath))
            self.assertTrue(os.path.exists(fusepath))
            self.assertEqual(filesystempath, filepath)
            self.assertNotEqual(filesystempath, fusepath)
            self.assertEqual(fusepath[:len(self.mainMountPath)], self.mainMountPath)
            with open(filepath) as file1:
                with open(fusepath) as file2:
                    self.assertEqual(file1.read(), file2.read())
            subpath = fusepath[len(self.mainMountPath):].lstrip('/')
            if self.knownPaths.get(subpath):
                with open(fusepath) as file1:
                    self.assertEqual(file1.read().strip(), self.knownPaths[subpath])
コード例 #3
0
ファイル: server_fuse_test.py プロジェクト: satra/girder
    def testFilePathNoFullPath(self):
        """
        Test that if an assetstore adapter doesn't respond to fullPath, we
        always get the fuse path.
        """
        from girder.plugins import fuse as girder_fuse
        from girder.utility.filesystem_assetstore_adapter import FilesystemAssetstoreAdapter

        file = File().findOne()

        origFullPath = FilesystemAssetstoreAdapter.fullPath
        FilesystemAssetstoreAdapter.fullPath = None
        filepath = girder_fuse.getFilePath(file)
        fusepath = girder_fuse.getFuseFilePath(file)
        FilesystemAssetstoreAdapter.fullPath = origFullPath
        self.assertTrue(os.path.exists(filepath))
        self.assertTrue(os.path.exists(fusepath))
        self.assertEqual(filepath, fusepath)
コード例 #4
0
ファイル: server_fuse_test.py プロジェクト: nicholsn/girder
    def testFilePathNoFullPath(self):
        """
        Test that if an assetstore adapter doesn't respond to fullPath, we
        always get the fuse path.
        """
        from girder.plugins import fuse as girder_fuse
        from girder.utility.filesystem_assetstore_adapter import FilesystemAssetstoreAdapter

        file = File().findOne()

        origFullPath = FilesystemAssetstoreAdapter.fullPath
        FilesystemAssetstoreAdapter.fullPath = None
        filepath = girder_fuse.getFilePath(file)
        fusepath = girder_fuse.getFuseFilePath(file)
        FilesystemAssetstoreAdapter.fullPath = origFullPath
        self.assertTrue(os.path.exists(filepath))
        self.assertTrue(os.path.exists(fusepath))
        self.assertEqual(filepath, fusepath)
コード例 #5
0
ファイル: server_fuse_test.py プロジェクト: eliasmarkc/girder
    def testFilePathNoLocalPath(self):
        """
        Test that if an assetstore adapter doesn't respond to getLocalFilePath,
        we always get the fuse path.
        """
        from girder.plugins import fuse as girder_fuse
        from girder.utility.filesystem_assetstore_adapter import FilesystemAssetstoreAdapter

        def getLocalFilePath(self, file):
            return super(FilesystemAssetstoreAdapter,
                         self).getLocalFilePath(file)

        file = File().findOne()

        origGetLocalFilePath = FilesystemAssetstoreAdapter.getLocalFilePath
        FilesystemAssetstoreAdapter.getLocalFilePath = getLocalFilePath
        filepath = girder_fuse.getFilePath(file)
        fusepath = girder_fuse.getFuseFilePath(file)
        FilesystemAssetstoreAdapter.getLocalFilePath = origGetLocalFilePath
        self.assertTrue(os.path.exists(filepath))
        self.assertTrue(os.path.exists(fusepath))
        self.assertEqual(filepath, fusepath)