<commit_before>import logging
import testUtils as utils

import time
import threading

from conftest import IPADDRESS1, \
                     RESOURCE, \
                     DUMMYVAL, \
                     OSCOREMASTERSECRET, \
                     OSCORESERVERID, \
                     OSCORECLIENTID

from coap     import coapDefines as d, \
                     coapOption as o, \
                     coapObjectSecurity as oscore

#============================ 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 = oscore.SecurityContext(masterSecret   = OSCOREMASTERSECRET,
                                         senderID       = OSCORESERVERID,
                                         recipientID    = OSCORECLIENTID)

        options = [o.ObjectSecurity(context=context)]
    
    # have coap2 do a get
    for _ in range(20):
        reply = coap2.GET(
            uri         = 'coap://[{0}]:{1}/{2}/'.format(IPADDRESS1,d.DEFAULT_UDP_PORT,RESOURCE),
            confirmable = False,
            options=options
        )
        assert reply==DUMMYVAL

<commit_msg>COAP-45. Fix multiple CON test.<commit_after>import logging
import testUtils as utils

import time
import threading

from conftest import IPADDRESS1, \
                     RESOURCE, \
                     DUMMYVAL, \
                     OSCOREMASTERSECRET, \
                     OSCORESERVERID, \
                     OSCORECLIENTID

from coap     import coapDefines as d, \
                     coapOption as o, \
                     coapObjectSecurity as oscore

#============================ 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 = oscore.SecurityContext(masterSecret   = OSCOREMASTERSECRET,
                                         senderID       = OSCORESERVERID,
                                         recipientID    = OSCORECLIENTID)

        options = [o.ObjectSecurity(context=context)]
    
    # have coap2 do a get
    for _ in range(20):
        reply = coap2.GET(
            uri         = 'coap://[{0}]:{1}/{2}/'.format(IPADDRESS1,d.DEFAULT_UDP_PORT,RESOURCE),
            confirmable = True,
            options=options
        )
        assert reply==DUMMYVAL


{'fraction_non_alphanumeric': 0.1576068376068376, 'fraction_numerical': 0.008205128205128205, 'mean_word_length': 1.7294776119402986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6063590', 'n_tokens_mistral': 824, 'n_tokens_neox': 751, 'n_words': 142}