当前位置: 首页>>代码示例>>Python>>正文


Python Gluster_DiskFile._create_dir_object方法代码示例

本文整理汇总了Python中gluster.swift.common.DiskFile.Gluster_DiskFile._create_dir_object方法的典型用法代码示例。如果您正苦于以下问题:Python Gluster_DiskFile._create_dir_object方法的具体用法?Python Gluster_DiskFile._create_dir_object怎么用?Python Gluster_DiskFile._create_dir_object使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gluster.swift.common.DiskFile.Gluster_DiskFile的用法示例。


在下文中一共展示了Gluster_DiskFile._create_dir_object方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_dir_object_exists

# 需要导入模块: from gluster.swift.common.DiskFile import Gluster_DiskFile [as 别名]
# 或者: from gluster.swift.common.DiskFile.Gluster_DiskFile import _create_dir_object [as 别名]
 def test_create_dir_object_exists(self):
     td = tempfile.mkdtemp()
     the_path = os.path.join(td, "vol0", "bar")
     the_dir = os.path.join(the_path, "dir")
     try:
         os.makedirs(the_path)
         with open(the_dir, "wb") as fd:
             fd.write("1234")
         gdf = Gluster_DiskFile(td, "vol0", "p57", "ufo47", "bar",
                                "dir/z", self.lg)
         # Not created, dir object path is different, just checking
         assert gdf._obj == "z"
         def _mock_do_chown(p, u, g):
             assert u == DEFAULT_UID
             assert g == DEFAULT_GID
         dc = gluster.swift.common.DiskFile.do_chown
         gluster.swift.common.DiskFile.do_chown = _mock_do_chown
         try:
             gdf._create_dir_object(the_dir)
         finally:
             gluster.swift.common.DiskFile.do_chown = dc
         assert os.path.isdir(the_dir)
         assert the_dir in _metadata
     finally:
         shutil.rmtree(td)
开发者ID:hfeeki,项目名称:glusterfs,代码行数:27,代码来源:test_diskfile.py

示例2: test_create_dir_object

# 需要导入模块: from gluster.swift.common.DiskFile import Gluster_DiskFile [as 别名]
# 或者: from gluster.swift.common.DiskFile.Gluster_DiskFile import _create_dir_object [as 别名]
 def test_create_dir_object(self):
     td = tempfile.mkdtemp()
     the_dir = os.path.join(td, "vol0", "bar", "dir")
     try:
         gdf = Gluster_DiskFile(td, "vol0", "p57", "ufo47", "bar", "dir/z", self.lg)
         # Not created, dir object path is different, just checking
         assert gdf._obj == "z"
         gdf._create_dir_object(the_dir)
         assert os.path.isdir(the_dir)
         assert the_dir in _metadata
     finally:
         shutil.rmtree(td)
开发者ID:portante,项目名称:glusterfs,代码行数:14,代码来源:test_diskfile.py

示例3: test_create_dir_object_no_md

# 需要导入模块: from gluster.swift.common.DiskFile import Gluster_DiskFile [as 别名]
# 或者: from gluster.swift.common.DiskFile.Gluster_DiskFile import _create_dir_object [as 别名]
 def test_create_dir_object_no_md(self):
     td = tempfile.mkdtemp()
     the_cont = os.path.join(td, "vol0", "bar")
     the_dir = "dir"
     try:
         os.makedirs(the_cont)
         gdf = Gluster_DiskFile(td, "vol0", "p57", "ufo47", "bar",
                                os.path.join(the_dir, "z"), self.lg)
         # Not created, dir object path is different, just checking
         assert gdf._obj == "z"
         gdf._create_dir_object(the_dir)
         full_dir_path = os.path.join(the_cont, the_dir)
         assert os.path.isdir(full_dir_path)
         assert full_dir_path not in _metadata
     finally:
         shutil.rmtree(td)
开发者ID:navidshaikh,项目名称:gluster-swift,代码行数:18,代码来源:test_diskfile.py

示例4: test_create_dir_object_with_md

# 需要导入模块: from gluster.swift.common.DiskFile import Gluster_DiskFile [as 别名]
# 或者: from gluster.swift.common.DiskFile.Gluster_DiskFile import _create_dir_object [as 别名]
 def test_create_dir_object_with_md(self):
     td = tempfile.mkdtemp()
     the_cont = os.path.join(td, "vol0", "bar")
     the_dir = "dir"
     try:
         os.makedirs(the_cont)
         gdf = Gluster_DiskFile(td, "vol0", "p57", "ufo47", "bar",
                                os.path.join(the_dir, "z"), self.lg)
         # Not created, dir object path is different, just checking
         assert gdf._obj == "z"
         dir_md = {'Content-Type': 'application/directory',
                   X_OBJECT_TYPE: DIR_OBJECT}
         gdf._create_dir_object(the_dir, dir_md)
         full_dir_path = os.path.join(the_cont, the_dir)
         assert os.path.isdir(full_dir_path)
         assert full_dir_path in _metadata
     finally:
         shutil.rmtree(td)
开发者ID:navidshaikh,项目名称:gluster-swift,代码行数:20,代码来源:test_diskfile.py


注:本文中的gluster.swift.common.DiskFile.Gluster_DiskFile._create_dir_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。