本文整理汇总了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])
示例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)
示例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()
示例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])
示例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])