本文整理汇总了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 == {})