Beispiel #1
0
def test_factory_unknown(logFixture):
    
    rc = e.coapRcFactory(1000)
    assert isinstance(rc,e.coapRcUnknown)
    assert rc.rc==1000
    
    
Beispiel #2
0
    def receiveMessage(self, timestamp, srcIp, srcPort, message):
        assert srcIp==self.destIp
        assert srcPort==self.destPort
        assert (message['token']==self.token) or (message['messageId']==self.messageId)

        # log
        log.debug('receiveMessage timestamp={0} srcIp={1} srcPort={2} message={3}'.format(timestamp,srcIp,srcPort,message))

        # turn message into exception if needed
        if message['code'] not in d.METHOD_ALL+d.COAP_RC_ALL_SUCCESS:
            message = e.coapRcFactory(message['code'])

        # store packet
        with self.dataLock:
            self.LastRxPacket = (timestamp,srcIp,srcPort,message)

        # signal reception
        self.rxMsgEvent.set()
Beispiel #3
0
def test_factory_unknown(logFixture):

    rc = e.coapRcFactory(1000)
    assert isinstance(rc, e.coapRcUnknown)
    assert rc.rc == 1000
Beispiel #4
0
def test_factory_successful(logFixture, rcValAndRcClass):

    (rcVal, rcClass) = rcValAndRcClass

    assert isinstance(e.coapRcFactory(rcVal), rcClass)
Beispiel #5
0
def test_factory_successful(logFixture,rcValAndRcClass):
    
    (rcVal,rcClass) = rcValAndRcClass
    
    assert isinstance(e.coapRcFactory(rcVal),rcClass)