import logging import testUtils from coap import coapOption as o, \ coapDefines as d, \ coapMessage as m, \ coapUtils as u import pytest #============================ logging =============================== log = logging.getLogger(testUtils.getMyLoggerName()) log.addHandler(testUtils.NullHandler()) #============================ defines =============================== #============================ fixtures ============================== MESSAGEANDBYTES = [ ( ( d.TYPE_NON, # type 0xaa, # token d.METHOD_GET, # code 0xbbcc, # messageId ( # options o.UriPath(path='test1'), o.UriPath(path='test2'), ), (0xee,0xff), # payload
import time 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)
import time import threading import pytest from conftest import IPADDRESS1, \ RESOURCE, \ DUMMYVAL from coap import coapDefines as d, \ coapResource, \ coapException as e #============================ logging ========================================= log = logging.getLogger(utils.getMyLoggerName()) log.addHandler(utils.NullHandler()) #============================ buggy =========================================== class buggyResource(coapResource.coapResource): def __init__(self): # initialize parent class coapResource.coapResource.__init__( self, path = 'buggy', ) #======================== parent methods ==================================
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 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',
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',