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', image='foo', volumes_from=[VolumeFromSpec(from_service, 'rw', 'service')])
    assert (service._get_volumes_from() == [(container_id + ':rw')])
    from_service.create_container.assert_called_once_with()
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', image='foo', volumes_from=[VolumeFromSpec(from_service, 'rw', 'service')])
    assert (service._get_volumes_from() == [(container_id + ':rw')])
    from_service.create_container.assert_called_once_with()