Skip to content

Core CSE & Registration

5 test modules, 81 test cases. ← Back to overview

testCSE.py — CSEBase (<CSE>) resource functionality (8 tests)
# Test Method Requests Performed
1 test_retrieveCSE RETRIEVE the <CSEBase> with a valid originator -> expects OK.
2 test_retrieveCSEWithWrongOriginator RETRIEVE the <CSEBase> with an invalid/unauthorized originator (CWrong) -> expects ORIGINATOR_HAS_NO_PRIVILEGE.
3 test_attributesCSE RETRIEVE the <CSEBase> -> expects OK; validates resource attributes in the response (csi, pi, rn, ty, ri, ct, cst, srt, srv) against expected values/types.
4 test_CSEreleaseVersion RETRIEVE the <CSEBase> -> expects OK; checks the X-M2M-RVI response header value is present in the resource's srv (supportedReleaseVersions) attribute.
5 test_attributeCSEctm RETRIEVE the <CSEBase> -> expects OK; validates the ctm (current time) attribute is a well-formed ISO 8601 timestamp.
6 test_CSESupportedResourceTypes RETRIEVE the <CSEBase> -> expects OK; checks that the srt (supportedResourceTypes) attribute lists every resource type the CSE supports.
7 test_deleteCSEFail DELETE the <CSEBase> -> expects OPERATION_NOT_ALLOWED.
8 test_updateCSEFail UPDATE the <CSEBase> setting lbl -> expects OPERATION_NOT_ALLOWED.
testAE.py — Application Entity (<AE>) registration, update, deletion, and attribute handling (27 tests)
# Test Method Requests Performed
1 test_createAE CREATE/register an <AE> under <CSEBase> using the self-registration originator -> expects CREATED; stores the assigned aei and acpi.
2 test_createAEUnderAEFail CREATE an <AE> under another <AE> (invalid parent) -> expects INVALID_CHILD_RESOURCE_TYPE.
3 test_createAEAgainFail CREATE an <AE> reusing the same rn as an existing registration -> expects CONFLICT.
4 test_createAEWithExistingOriginatorFail CREATE an <AE> (no rn) using an originator that's already registered -> expects ORIGINATOR_HAS_ALREADY_REGISTERED.
5 test_createAECSIoriginatorFail CREATE an <AE> using the CSE-ID itself as originator -> expects SECURITY_ASSOCIATION_REQUIRED.
6 test_retrieveAE RETRIEVE the <AE> -> expects OK.
7 test_retrieveAEWithWrongOriginator RETRIEVE the <AE> with an unauthorized originator -> expects one of ORIGINATOR_HAS_NO_PRIVILEGE / SERVICE_SUBSCRIPTION_NOT_ESTABLISHED.
8 test_attributesAE RETRIEVE the <AE> -> expects OK; checks aei, ty, api, ct/lt/et ordering, rr=False, srv, st (absent), pi matches CSEBase's ri.
9 test_updateAELbl UPDATE the <AE> setting lbl -> expects UPDATED; RETRIEVE it again -> expects OK, checks lbl contains the new tag.
10 test_updateAETy UPDATE the <AE> attempting to change ty to CSEBase -> expects BAD_REQUEST.
11 test_updateAEPi UPDATE the <AE> attempting to change pi -> expects BAD_REQUEST.
12 test_updateAEUnknownAttribute UPDATE the <AE> with an unknown attribute -> expects BAD_REQUEST.
13 test_deleteAEByUnknownOriginator DELETE the <AE> with an unauthorized originator -> expects ORIGINATOR_HAS_NO_PRIVILEGE.
14 test_deleteAEByAssignedOriginator DELETE the <AE> with the correct originator -> expects DELETED.
15 test_createAEWrongCSZ CREATE an <AE> with an invalid csz (content serialization) value -> expects BAD_REQUEST.
16 test_createAECSZ CREATE an <AE> with valid csz values (application/cbor, application/json) -> expects CREATED.
17 test_deleteAECSZ DELETE the CSZ-configured <AE> -> expects DELETED.
18 test_createAENoAPI CREATE an <AE> missing the mandatory api attribute -> expects something other than CREATED.
19 test_createAEAPIWrongPrefix CREATE an <AE> with an api value using an unknown prefix character (X) -> expects something other than CREATED.
20 test_createAEAPICorrectR CREATE an <AE> with a valid api using the 'Registered' (R) prefix -> expects CREATED; DELETE it -> expects DELETED.
21 test_createAEAPICorrectN CREATE an <AE> with a valid api using the 'Non-Registered' (N) prefix -> expects CREATED; DELETE it -> expects DELETED.
22 test_createAEAPIRVI3LowerCaseR CREATE an <AE> with a lower-case api prefix under release version 3 (X-M2M-RVI: 3) -> expects CREATED (lowercase allowed pre-RVI4); DELETE it -> expects DELETED.
23 test_createAEAPIRVI4LowerCaseRFail Same lower-case api prefix but under release version 4 -> expects BAD_REQUEST (lowercase no longer allowed).
24 test_createAENoOriginator CREATE an <AE> with no originator at all -> expects CREATED (CSE auto-assigns one); checks aei is present; DELETE it -> expects DELETED.
25 test_createAEEmptyOriginator CREATE an <AE> with an explicitly empty-string originator -> expects CREATED; checks aei; DELETE it -> expects DELETED.
26 test_createAEInvalidRNFail CREATE an <AE> with an rn containing a disallowed character (?) -> expects BAD_REQUEST; CREATE another with a space in rn -> expects BAD_REQUEST.
27 test_createAEWithCreatorFail CREATE an <AE> with cr explicitly set to None -> expects BAD_REQUEST (creator attribute not permitted for AE self-registration).
testNOD.py — Node (<NOD>) resource lifecycle and notifications (13 tests)
# Test Method Requests Performed
1 test_createNOD CREATE a <NOD> under the <CSEBase> with a node-ID (ni) -> expects CREATED; checks ri is present.
2 test_retrieveNOD RETRIEVE the <NOD> -> expects OK.
3 test_retrieveNODWithWrongOriginator RETRIEVE the <NOD> with an unauthorized originator -> expects ORIGINATOR_HAS_NO_PRIVILEGE.
4 test_attributesNOD RETRIEVE the <NOD> -> expects OK; checks ty, pi (matches the CSEBase's ri), rn, ct, lt, et, and ni.
5 test_updateNODLbl UPDATE the <NOD> setting lbl -> expects UPDATED; RETRIEVE it again -> expects OK, checks lbl contains the new tag.
6 test_updateNODUnknownAttribute UPDATE the <NOD> with an unknown attribute -> expects BAD_REQUEST.
7 test_createAEForNOD CREATE an <AE> with its nl (node link) pointing to the <NOD> -> expects CREATED, checks nl/ri/aei; RETRIEVE the <NOD> -> expects OK, checks the AE's ri is listed in the node's hael (hosted AE list).
8 test_deleteAEForNOD DELETE the <AE> -> expects DELETED; RETRIEVE the <NOD> -> expects OK, checks hael is now absent (no more hosted AEs).
9 test_moveAEToNOD2 Re-create the <AE> linked to the first <NOD> (calls test_createAEForNOD); CREATE a 2nd <NOD> -> expects CREATED; UPDATE the <AE> to set nl to the 2nd node -> expects UPDATED, checks nl; RETRIEVE the 1st <NOD> -> expects OK, checks hael is now absent; RETRIEVE the 2nd <NOD> -> expects OK, checks hael now contains the AE's ri.
10 test_deleteNOD2 DELETE the 2nd <NOD> -> expects DELETED; RETRIEVE the <AE> -> expects OK, checks nl is now absent (link removed when its target node was deleted).
11 test_deleteNOD DELETE the (first) <NOD> -> expects DELETED.
12 test_createNODEmptyHael CREATE a <NOD> with an explicit empty hael list -> expects BAD_REQUEST.
13 test_createNODDoubleHael CREATE a <NOD> with a pre-set hael list containing one entry -> expects CREATED, checks hael has length 1; CREATE an <AE> whose nl points to that node -> expects CREATED; RETRIEVE the <NOD> -> expects OK, checks hael still has exactly 1 entry containing the AE's ri (no duplicate); DELETE the <AE> and the <NOD> -> each expects DELETED.
testRequests.py — General request handling, headers, and response codes (17 tests)
# Test Method Requests Performed
1 test_OETnow RETRIEVE the <AE> with the OET (Operation Execution Time) header set to the current time -> expects OK.
2 test_OETpast RETRIEVE the <AE> with OET set 10 seconds in the past -> expects OK.
3 test_OETfuture RETRIEVE the <AE> with OET set to an absolute future timestamp -> expects OK; checks the request actually waited until that time before executing.
4 test_OETfuturePeriod RETRIEVE the <AE> with OET given as an ISO-8601 period (e.g. PT2S) in the future -> expects OK; checks the request waited the corresponding time.
5 test_OETfutureSeconds RETRIEVE the <AE> with OET given in milliseconds-from-now -> expects OK; checks the request waited accordingly.
6 test_OETafterRSETFail RETRIEVE the <AE> with OET set later than RSET (Result Set Expiration Time) -> expects BAD_REQUEST.
7 test_OETafterRQETFail RETRIEVE the <AE> with OET set later than RET/RQET (Request Expiration Time) -> expects BAD_REQUEST.
8 test_RETnowFail RETRIEVE the <AE> with RET set to right now -> expects REQUEST_TIMEOUT (no time left to process).
9 test_RETpastFail RETRIEVE the <AE> with RET set 10 seconds in the past -> expects REQUEST_TIMEOUT.
10 test_RETfuture RETRIEVE the <AE> with RET set to an absolute future timestamp -> expects OK.
11 test_RETpastSecondsFail RETRIEVE the <AE> with RET given as a negative milliseconds offset -> expects REQUEST_TIMEOUT.
12 test_RETfutureSeconds RETRIEVE the <AE> with RET given in milliseconds-from-now (positive) -> expects OK.
13 test_OETRETfutureSeconds RETRIEVE the <AE> with both RET and OET in the future, OET earlier than RET -> expects OK (valid ordering).
14 test_OETRETfutureSecondsWrongFail RETRIEVE the <AE> with OET later than RET (invalid ordering) -> expects BAD_REQUEST.
15 test_RSETsmallerThanRETFail RETRIEVE the <AE> with RST (Result Set Time?) smaller than RET in an invalid combination -> expects BAD_REQUEST.
16 test_RSETpastFail RETRIEVE the <AE> with RST set in the past -> expects REQUEST_TIMEOUT.
17 test_RSETNonBlockingSynchFail RETRIEVE the <AE> with rt=nonBlockingRequestSynch and a short RST header -> expects ACCEPTED_NON_BLOCKING_REQUEST_SYNC, checks the m2m:uri reference and the echoed RST header; sleeps past the request-expiration window; RETRIEVE the referenced result resource -> expects NOT_FOUND (result expired before being collected).
testAddressing.py — CSE resource addressing methods (structured/unstructured, CSE-relative, SP-relative, etc.) (16 tests)
# Test Method Requests Performed
1 test_cseRelativeStructured RETRIEVE a <CNT> via CSE-relative structured addressing ({cseRN}/{aeRN}/{cntRN}) -> expects OK; repeats using the - CSEBase placeholder in place of the CSE name -> expects OK; both check the returned rn.
2 test_cseRelativeStructuredPlaceholder RETRIEVE the <CNT> via CSE-relative structured addressing using the - placeholder for the CSEBase name -> expects OK; checks rn.
3 test_cseRelativeUnstructured RETRIEVE the <CNT> via CSE-relative unstructured addressing (CSE root + resource-ID) -> expects OK; checks rn.
4 test_spRelativeStructured RETRIEVE the <CNT> via SP-relative structured addressing (/{cseId}/{cseRN}/{aeRN}/{cntRN}) -> expects OK; repeats with the - CSEBase placeholder -> expects OK; both check rn.
5 test_spRelativeStructuredPlaceholder RETRIEVE the <CNT> via SP-relative structured addressing using the - CSEBase placeholder -> expects OK; checks rn.
6 test_spRelativeUnstructured RETRIEVE the <CNT> via SP-relative unstructured addressing (/{cseId}/{resourceId}) -> expects OK; checks rn.
7 test_spRelativeCSEIDFail RETRIEVE using SP-relative addressing pointing only at the bare CSE-ID (no resource path) -> expects BAD_REQUEST.
8 test_absoluteStructured RETRIEVE the <CNT> via absolute structured addressing (//{spId}{cseId}/{cseRN}/{aeRN}/{cntRN}) -> expects OK; repeats with the - placeholder -> expects OK; both check rn.
9 test_absoluteStructuredPlaceholder RETRIEVE the <CNT> via absolute structured addressing using the - CSEBase placeholder -> expects OK.
10 test_absoluteUnstructured RETRIEVE the <CNT> via absolute unstructured addressing (//{spId}{cseId}/{resourceId}) -> expects OK; checks rn.
11 test_absoluteStructuredWrongSPIDFail RETRIEVE via absolute structured addressing with an incorrect/unknown SP-ID -> expects NOT_FOUND.
12 test_absoluteUnstructuredWrongSPIDFail RETRIEVE via absolute unstructured addressing with an incorrect/unknown SP-ID -> expects NOT_FOUND.
13 test_absoluteCSEIDFail RETRIEVE via absolute addressing pointing only at the bare SP-ID + CSE-ID (no resource path) -> expects BAD_REQUEST.
14 test_cseRelativeTrailingSlashFail RETRIEVE using CSE-relative addressing with a trailing slash after the CSE resource name -> expects BAD_REQUEST.
15 test_spRelativeTrailingSlashFail RETRIEVE using SP-relative addressing with a trailing slash -> expects BAD_REQUEST.
16 test_absoluteTrailingSlashFail RETRIEVE using absolute addressing with a trailing slash -> expects BAD_REQUEST.