def test_get_volumes_from_service_container_exists_with_flags(self):
    for mode in ['ro', 'rw', 'z', 'rw,z', 'z,rw']:
        container_ids = [('aabbccddee:' + mode), ('12345:' + mode)]
        from_service = mock.create_autospec(Service)
        from_service.containers.return_value = [mock.Mock(id=container_id.split(':')[0], spec=Container) for container_id in container_ids]
        service = Service('test', volumes_from=[VolumeFromSpec(from_service, mode, 'service')], image='foo')
        assert (service._get_volumes_from() == [container_ids[0]])
def test_get_volumes_from_service_container_exists_with_flags(self):
    for mode in ['ro', 'rw', 'z', 'rw,z', 'z,rw']:
        container_ids = [('aabbccddee:' + mode), ('12345:' + mode)]
        from_service = mock.create_autospec(Service)
        from_service.containers.return_value = [mock.Mock(id=container_id.split(':')[0], spec=Container) for container_id in container_ids]
        service = Service('test', volumes_from=[VolumeFromSpec(from_service, mode, 'service')], image='foo')
        assert (service._get_volumes_from() == [container_ids[0]])