Exemple #1
0
def test_factory_unknown(logFixture):
    
    rc = e.coapRcFactory(1000)
    assert isinstance(rc,e.coapRcUnknown)
    assert rc.rc==1000
    
    
Exemple #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()
Exemple #3
0
def test_factory_unknown(logFixture):

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

    (rcVal, rcClass) = rcValAndRcClass

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