當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。