def main():
    with MockSCSI(MockReadCapacity10(sbc)) as s:
        i = s.readcapacity10().result
        assert i['returned_lba'] == 65536
        assert i['block_length'] == 4096

        d = ReadCapacity10.unmarshall_datain(ReadCapacity10.marshall_datain(i))
        assert d == i
Ejemplo n.º 2
0
    def test_main(self):
        with MockSCSI(MockReadCapacity10(sbc)) as s:
            i = s.readcapacity10().result
            self.assertEqual(i['returned_lba'], 65536)
            self.assertEqual(i['block_length'], 4096)

            d = ReadCapacity10.unmarshall_datain(ReadCapacity10.marshall_datain(i))
            self.assertEqual(d, i)
Ejemplo n.º 3
0
def main():
    with MockSCSI(MockReadCapacity10(sbc)) as s:
        i = s.readcapacity10().result
        assert i['returned_lba'] == 65536
        assert i['block_length'] == 4096

        d = ReadCapacity10.unmarshall_datain(ReadCapacity10.marshall_datain(i))
        assert d == i
def main():
    dev = MockReadCapacity10()
    dev.opcodes = sbc
    s = SCSI(dev)

    i = s.readcapacity10().result
    assert i["returned_lba"] == 65536
    assert i["block_length"] == 4096

    d = ReadCapacity10.unmarshall_datain(ReadCapacity10.marshall_datain(i))
    assert d == i
def main():
    dev = MockReadCapacity10()
    dev.opcodes = sbc
    s = SCSI(dev)

    i = s.readcapacity10().result
    assert i['returned_lba'] == 65536
    assert i['block_length'] == 4096

    d = ReadCapacity10.unmarshall_datain(ReadCapacity10.marshall_datain(i))
    assert d == i
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        r = s.readcapacity10()
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.READ_CAPACITY_10.value
        assert cdb[1:10] == bytearray(9)
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.READ_CAPACITY_10.value

        d = ReadCapacity10.unmarshall_cdb(ReadCapacity10.marshall_cdb(cdb))
        assert d == cdb
    def test_main(self):

        with MockSCSI(MockDevice(sbc)) as s:
            r = s.readcapacity10()
            cdb = r.cdb
            self.assertEqual(cdb[0], s.device.opcodes.READ_CAPACITY_10.value)
            self.assertEqual(cdb[1:10], bytearray(9))
            cdb = r.unmarshall_cdb(cdb)
            self.assertEqual(cdb['opcode'], s.device.opcodes.READ_CAPACITY_10.value)

            d = ReadCapacity10.unmarshall_cdb(ReadCapacity10.marshall_cdb(cdb))
            self.assertEqual(d, cdb)
Ejemplo n.º 8
0
def main():

    with MockSCSI(MockDevice(sbc)) as s:
        r = s.readcapacity10()
        cdb = r.cdb
        assert cdb[0] == s.device.opcodes.READ_CAPACITY_10.value
        assert cdb[1:10] == bytearray(9)
        cdb = r.unmarshall_cdb(cdb)
        assert cdb['opcode'] == s.device.opcodes.READ_CAPACITY_10.value

        d = ReadCapacity10.unmarshall_cdb(ReadCapacity10.marshall_cdb(cdb))
        assert d == cdb
Ejemplo n.º 9
0
def main():
    dev = MockReadCapacity10()
    dev.opcodes = sbc
    s = SCSI(dev)

    s.device.opcodes = sbc
    r = s.readcapacity10()
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.READ_CAPACITY_10.value
    assert cdb[1:10] == bytearray(9)
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.READ_CAPACITY_10.value

    d = ReadCapacity10.unmarshall_cdb(ReadCapacity10.marshall_cdb(cdb))
    assert d == cdb
def main():
    dev = MockReadCapacity10()
    dev.opcodes = sbc
    s = SCSI(dev)

    s.device.opcodes = sbc
    r = s.readcapacity10()
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.READ_CAPACITY_10.value
    assert cdb[1:10] == bytearray(9)
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.READ_CAPACITY_10.value

    d = ReadCapacity10.unmarshall_cdb(ReadCapacity10.marshall_cdb(cdb))
    assert d == cdb
Ejemplo n.º 11
0
    def readcapacity10(self, **kwargs):
        """
        Returns a ReadCapacity10 Instance

        :param alloc_len = 8: size of requested datain
        :return: a ReadCapacity10 instance
        """
        return ReadCapacity10(self, **kwargs)
Ejemplo n.º 12
0
    def readcapacity10(self, **kwargs):
        """
        Returns a ReadCapacity10 Instance

        :param kwargs: a dict with key/value pairs
                       alloc_len = 8, size of requested datain
        :return: a ReadCapacity10 instance
        """
        opcode = self.device.opcodes.READ_CAPACITY_10
        cmd = ReadCapacity10(opcode=opcode, **kwargs)
        self.execute(cmd)
        cmd.unmarshall()
        return cmd