def test_get_container_data_volumes(self):
    options = [VolumeSpec.parse(v) for v in ['/host/volume:/host/volume:ro', '/new/volume', '/existing/volume', 'named:/named/vol', '/dev/tmpfs']]
    self.mock_client.inspect_image.return_value = {'ContainerConfig': {'Volumes': {'/mnt/image/data': {}}}}
    container = Container(self.mock_client, {'Image': 'ababab', 'Mounts': [{'Source': '/host/volume', 'Destination': '/host/volume', 'Mode': '', 'RW': True, 'Name': 'hostvolume'}, {'Source': '/var/lib/docker/aaaaaaaa', 'Destination': '/existing/volume', 'Mode': '', 'RW': True, 'Name': 'existingvolume'}, {'Source': '/var/lib/docker/bbbbbbbb', 'Destination': '/removed/volume', 'Mode': '', 'RW': True, 'Name': 'removedvolume'}, {'Source': '/var/lib/docker/cccccccc', 'Destination': '/mnt/image/data', 'Mode': '', 'RW': True, 'Name': 'imagedata'}]}, has_been_inspected=True)
    expected = [VolumeSpec.parse('existingvolume:/existing/volume:rw'), VolumeSpec.parse('imagedata:/mnt/image/data:rw')]
    (volumes, _) = get_container_data_volumes(container, options, ['/dev/tmpfs'], [])
    assert (sorted(volumes) == sorted(expected))
def test_get_container_data_volumes(self):
    options = [VolumeSpec.parse(v) for v in ['/host/volume:/host/volume:ro', '/new/volume', '/existing/volume', 'named:/named/vol', '/dev/tmpfs']]
    self.mock_client.inspect_image.return_value = {'ContainerConfig': {'Volumes': {'/mnt/image/data': {}}}}
    container = Container(self.mock_client, {'Image': 'ababab', 'Mounts': [{'Source': '/host/volume', 'Destination': '/host/volume', 'Mode': , 'RW': True, 'Name': 'hostvolume'}, {'Source': '/var/lib/docker/aaaaaaaa', 'Destination': '/existing/volume', 'Mode': , 'RW': True, 'Name': 'existingvolume'}, {'Source': '/var/lib/docker/bbbbbbbb', 'Destination': '/removed/volume', 'Mode': , 'RW': True, 'Name': 'removedvolume'}, {'Source': '/var/lib/docker/cccccccc', 'Destination': '/mnt/image/data', 'Mode': , 'RW': True, 'Name': 'imagedata'}]}, has_been_inspected=True)
    expected = [VolumeSpec.parse('existingvolume:/existing/volume:rw'), VolumeSpec.parse('imagedata:/mnt/image/data:rw')]
    (volumes, _) = get_container_data_volumes(container, options, ['/dev/tmpfs'], [])
    assert (sorted(volumes) == sorted(expected))