Ejemplo n.º 1
0
 def setUp(self):
     self._protocol = Protocol('TestProtocol')
     self._protocol.add(UInt(2, 'msgId', 5))
     self._protocol.add(UInt(2, 'length', None))
     self._protocol.add(PDU('length-4'))
     self.tmp = MessageTemplate('FooRequest', self._protocol, {})
     self.tmp.add(UInt(2, 'field_1', 1))
     self.tmp.add(UInt(2, 'field_2', 2))
Ejemplo n.º 2
0
 def setUp(self):
     self._protocol = Protocol('TestProtocol', little_endian=True)
     self._protocol.add(UInt(2, 'msgId', 5))
     self._protocol.add(UInt(2, 'length', None))
     self._protocol.add(PDU('length-4'))
     self.tmp = MessageTemplate('FooRequest', self._protocol, {})
     self.tmp.add(UInt(2, 'field_1', '0xcafe'))
     self.tmp.add(UInt(2, 'field_2', '0xbabe'))
Ejemplo n.º 3
0
 def setUp(self):
     self._protocol = Protocol('TestProtocol')
     self._protocol.add(UInt(2, 'msgId', 5))
     self._protocol.add(UInt(2, 'length', None))
     self._protocol.add(PDU('length-4'))
     self.tmp = MessageTemplate('FooRequest', self._protocol, {})
     self.tmp.add(UInt(2, 'field_1', '0xcafe'))
     self.tmp.add(UInt(2, 'field_2', '0xbabe'))
     self.example = self.tmp.encode({}, {})
Ejemplo n.º 4
0
 def test_access_struct(self):
     self._protocol = Protocol('TestProtocol')
     self._protocol.add(UInt(2, 'msgId', 5))
     self._protocol.add(UInt(2, 'length', None))
     self._protocol.add(PDU('length-4'))
     self.tmp = MessageTemplate('StructuredRequest', self._protocol, {})
     struct = get_pair()
     self.tmp.add(struct)
     msg = self.tmp.encode({}, {})
     self.assertEquals(msg.pair.first.int, 1)
Ejemplo n.º 5
0
 def setUp(self):
     self._protocol = Protocol('Test')
Ejemplo n.º 6
0
def _get_template():
    protocol = Protocol('Test')
    protocol.add(UInt(1, 'id', 1))
    protocol.add(UInt(2, 'length', None))
    protocol.add(PDU('length-2'))
    return protocol
Ejemplo n.º 7
0
 def setUp(self):
     self._protocol = Protocol('TestProtocol')
     self._protocol.add(UInt(2, 'msgId', 5))
     self._protocol.add(UInt(2, 'length', None))
     self._protocol.add(PDU('length-4'))