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


Python Image._marker_files方法代码示例

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


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

示例1: TestMarkerFiles

# 需要导入模块: from docker_squash.image import Image [as 别名]
# 或者: from docker_squash.image.Image import _marker_files [as 别名]
class TestMarkerFiles(unittest.TestCase):

    def setUp(self):
        self.docker_client = mock.Mock()
        self.log = mock.Mock()
        self.image = "whatever"
        self.squash = Image(self.log, self.docker_client, self.image, None)

    def _tar_member(self, ret_val):
        member = mock.Mock()
        member.name = ret_val
        return member

    def test_should_find_all_marker_files(self):
        files = []

        for path in ['/opt/eap', '/opt/eap/one', '/opt/eap/.wh.to_skip']:
            files.append(self._tar_member(path))

        tar = mock.Mock()
        markers = self.squash._marker_files(tar, files)

        self.assertTrue(len(markers) == 1)
        self.assertTrue(list(markers)[0].name == '/opt/eap/.wh.to_skip')

    def test_should_return_empty_dict_when_no_files_are_in_the_tar(self):
        tar = mock.Mock()
        markers = self.squash._marker_files(tar, [])
        self.assertTrue(markers == {})

    def test_should_return_empty_dict_when_no_marker_files_are_found(self):
        files = []

        for path in ['/opt/eap', '/opt/eap/one']:
            files.append(self._tar_member(path))

        tar = mock.Mock()
        markers = self.squash._marker_files(tar, files)

        self.assertTrue(len(markers) == 0)
        self.assertTrue(markers == {})
开发者ID:gcstang,项目名称:docker-scripts,代码行数:43,代码来源:test_unit_v1_image.py


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