import logging import testUtils from coap import coapException as e, \ coapDefines as d import pytest #============================ logging =============================== log = logging.getLogger(testUtils.getMyLoggerName()) log.addHandler(testUtils.NullHandler()) #============================ fixtures ============================== RCVALANDRCCLASS = [ (d.COAP_RC_2_01_CREATED, e.coapRcCreated), (d.COAP_RC_2_02_DELETED, e.coapRcDeleted), (d.COAP_RC_2_03_VALID, e.coapRcValid), (d.COAP_RC_2_04_CHANGED, e.coapRcChanged), (d.COAP_RC_2_05_CONTENT, e.coapRcContent), (d.COAP_RC_4_00_BADREQUEST, e.coapRcBadRequest), (d.COAP_RC_4_01_UNAUTHORIZED, e.coapRcUnauthorized), (d.COAP_RC_4_02_BADOPTION, e.coapRcBadOption), (d.COAP_RC_4_03_FORBIDDEN, e.coapRcForbidden), (d.COAP_RC_4_04_NOTFOUND, e.coapRcNotFound), (d.COAP_RC_4_05_METHODNOTALLOWED, e.coapRcMethodNotAllowed), (d.COAP_RC_4_06_NOTACCEPTABLE, e.coapRcMethodNotAcceptable), (d.COAP_RC_4_12_PRECONDITIONFAILED, e.coapRcPreconditionFailed), (d.COAP_RC_4_13_REQUESTENTITYTOOLARGE, e.coapRcRequestEntityTooLarge), (d.COAP_RC_4_15_UNSUPPORTEDCONTENTFORMAT,
import threading from conftest import IPADDRESS1, \ RESOURCE, \ DUMMYVAL, \ OSCOAPMASTERSECRET, \ OSCOAPSERVERID, \ OSCOAPCLIENTID from coap import coapDefines as d, \ coapOption as o, \ coapObjectSecurity as oscoap #============================ logging =============================== log = logging.getLogger(utils.getMyLoggerName()) log.addHandler(utils.NullHandler()) #============================ tests =========================================== def test_GET(logFixture, snoopyDispatcher, twoEndPoints): (coap1, coap2, securityEnabled) = twoEndPoints options = [] if securityEnabled: context = oscoap.SecurityContext(masterSecret=OSCOAPMASTERSECRET, senderID=OSCOAPSERVERID, recipientID=OSCOAPCLIENTID) options = [o.ObjectSecurity(context=context)]
import logging import testUtils as u from coap import coapOption, \ coapDefines as d, \ coapUri import pytest #============================ logging =============================== log = logging.getLogger(u.getMyLoggerName()) log.addHandler(u.NullHandler()) #============================ defines =============================== #============================ fixtures ============================== URIANDOPTIONS = [ ('coap://[aaaa::1]/', ( 'aaaa::1', d.DEFAULT_UDP_PORT, (), )), ('coap://[aaaa::1]/test', ( 'aaaa::1', d.DEFAULT_UDP_PORT, (coapOption.UriPath(path='test'), ), )), ('coap://[aaaa::1]:1234/test', ( 'aaaa::1',