Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_logvoldesc_equals():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
logvol.new()
logvol2 = pycdlib.udf.UDFLogicalVolumeDescriptor()
logvol2.new()
assert(logvol == logvol2)
def test_logvoldesc_set_integrity_location_not_initialized():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
logvol.set_integrity_location(0)
assert(str(excinfo.value) == 'UDF Logical Volume Descriptor not initialized')
def test_logvoldesc_parse_bad_map_data():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
tag = pycdlib.udf.UDFTag()
tag.new(0, 0)
with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
logvol.parse(b'\x00'*16 + b'\x00\x00\x00\x00' + b'\x00'*64 + b'\x00'*128 + b'\x00\x08\x00\x00' + b'\x00*OSTA UDF Compliant' + b'\x00'*12 + b'\x00'*16 + b'\x00\x00\x00\x00\x01\x00\x00\x00' + b'\x00'*32 + b'\x00'*128 + b'\x00'*8 + b'\x00\x80' + b'\x00'*70, 0, tag)
assert(str(excinfo.value) == 'Partition map goes beyond end of data, ISO corrupt')
def test_logvoldesc_equals():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
logvol.new()
logvol2 = pycdlib.udf.UDFLogicalVolumeDescriptor()
logvol2.new()
assert(logvol == logvol2)
def test_logvoldesc_parse_bad_logical_block_size():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
tag = pycdlib.udf.UDFTag()
tag.new(0, 0)
with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidISO) as excinfo:
logvol.parse(b'\x00'*16 + b'\x00\x00\x00\x00' + b'\x00'*64 + b'\x00'*128 + b'\x00\x07\x00\x00' + b'\x00*OSTA UDF Compliant' + b'\x00'*12 + b'\x00'*16 + b'\x00\x00\x00\x00\x00\x00\x00\x00' + b'\x00'*32 + b'\x00'*128 + b'\x00'*8 + b'\x00'*72, 0, tag)
assert(str(excinfo.value) == 'Volume Descriptor block size is not 2048')
def test_logvoldesc_extent_location_not_initialized():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
logvol.extent_location()
assert(str(excinfo.value) == 'UDF Logical Volume Descriptor not initialized')
def test_logvoldesc_add_partition_map_not_initialized():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
logvol.add_partition_map(1)
assert(str(excinfo.value) == 'UDF Logical Volume Descriptor not initialized')
def test_logvoldesc_add_partition_map_type_0():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
logvol.new()
logvol.add_partition_map(0)
assert(len(logvol.partition_maps) == 1)
def test_logvoldesc_new_initialized_twice():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
logvol.new()
with pytest.raises(pycdlib.pycdlibexception.PyCdlibInternalError) as excinfo:
logvol.new()
assert(str(excinfo.value) == 'UDF Logical Volume Descriptor already initialized')
def test_logvoldesc_parse_map_type_0():
logvol = pycdlib.udf.UDFLogicalVolumeDescriptor()
tag = pycdlib.udf.UDFTag()
tag.new(0, 0)
logvol.parse(b'\x00'*16 + b'\x00\x00\x00\x00' + b'\x00'*64 + b'\x00'*128 + b'\x00\x08\x00\x00' + b'\x00*OSTA UDF Compliant' + b'\x00'*12 + b'\x00'*16 + b'\x02\x00\x00\x00\x01\x00\x00\x00' + b'\x00'*32 + b'\x00'*128 + b'\x00'*8 + b'\x00\x02' + b'\x00'*70, 0, tag)
assert(len(logvol.partition_maps) == 1)
assert(isinstance(logvol.partition_maps[0], pycdlib.udf.UDFType0PartitionMap))