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


Python Service._get_volumes_from方法代码示例

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


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

示例1: test_get_volumes_from_container

# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_volumes_from [as 别名]
    def test_get_volumes_from_container(self):
        container_id = 'aabbccddee'
        service = Service(
            'test',
            volumes_from=[mock.Mock(id=container_id, spec=Container)])

        self.assertEqual(service._get_volumes_from(), [container_id])
开发者ID:Jasperswaagman,项目名称:compose,代码行数:9,代码来源:service_test.py

示例2: test_get_volumes_from_service_container_exists

# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_volumes_from [as 别名]
    def test_get_volumes_from_service_container_exists(self):
        container_ids = ['aabbccddee', '12345']
        from_service = mock.create_autospec(Service)
        from_service.containers.return_value = [
            mock.Mock(id=container_id, spec=Container)
            for container_id in container_ids
        ]
        service = Service('test', volumes_from=[from_service])

        self.assertEqual(service._get_volumes_from(), container_ids)
开发者ID:Jasperswaagman,项目名称:compose,代码行数:12,代码来源:service_test.py

示例3: test_get_volumes_from_service_no_container

# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_volumes_from [as 别名]
    def test_get_volumes_from_service_no_container(self):
        container_id = 'abababab'
        from_service = mock.create_autospec(Service)
        from_service.containers.return_value = []
        from_service.create_container.return_value = mock.Mock(
            id=container_id,
            spec=Container)
        service = Service('test', volumes_from=[from_service])

        self.assertEqual(service._get_volumes_from(), [container_id])
        from_service.create_container.assert_called_once_with()
开发者ID:Jasperswaagman,项目名称:compose,代码行数:13,代码来源:service_test.py

示例4: test_get_volumes_from_intermediate_container

# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_volumes_from [as 别名]
    def test_get_volumes_from_intermediate_container(self):
        container_id = 'aabbccddee'
        service = Service('test')
        container = mock.Mock(id=container_id, spec=Container)

        self.assertEqual(service._get_volumes_from(container), [container_id])
开发者ID:Jasperswaagman,项目名称:compose,代码行数:8,代码来源:service_test.py

示例5: test_get_volumes_from_previous_container

# 需要导入模块: from compose import Service [as 别名]
# 或者: from compose.Service import _get_volumes_from [as 别名]
    def test_get_volumes_from_previous_container(self):
        container_id = 'aabbccddee'
        service = Service('test', image='foo')
        container = mock.Mock(id=container_id, spec=Container, image='foo')

        self.assertEqual(service._get_volumes_from(container), [container_id])
开发者ID:CSWANG,项目名称:compose,代码行数:8,代码来源:service_test.py


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