diff --git a/code/Test_definitions/webrtc-call-handling-createSession.feature b/code/Test_definitions/webrtc-call-handling-createSession.feature index 65a9918..a10c82b 100644 --- a/code/Test_definitions/webrtc-call-handling-createSession.feature +++ b/code/Test_definitions/webrtc-call-handling-createSession.feature @@ -1,82 +1,196 @@ Feature: CAMARA WebRTC Call Handling, vwip - Operation createSession + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Whether callType "EMERGENCY" is supported. Support for EMERGENCY is implementation-declared: + # if supported, the EMERGENCY success scenario applies; if not, the 422 CALLTYPE_EMERGENCY_NOT_SUPPORTED scenario applies. + # + # Testing assets: + # * A valid registrationId of an active registration created by operation "createRegistration" of webrtc-registration API. + # * An originatorAddress belonging to that registration and a reachable receiverAddress. + # * A valid WebRTC SDP offer. + # * If EMERGENCY is supported, an emergency test environment where calls to an emergency service URN can be placed safely. + # + # References to OAS spec schemas refer to schemas specified in webrtc-call-handling.yaml + Background: Common createSession setup Given an environment at "apiRoot" - And the resource "/webrtc-call-handling/vwip/sessions" | + And the resource "/webrtc-call-handling/vwip/sessions" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the header "registrationId" is set to a UUID value - - @webrtc_call_handling_createSession_01_generic_success_scenario - Scenario: Create a new call session - When the client sends a POST request to "/sessions" with the following payload: - """ - { - "originatorAddress": "tel:+17085852753", - "receiverAddress": "tel:+17085854000", - "offer": { - "sdp": "v=0\r\no=- 8066321617929821805 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\nm=audio 42988 RTP/SAVPF 102 113\r\nc=IN IP6 2001:e0:410:2448:7a05:9b11:66f2:c9e\r\nb=AS:64\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=candidate:1645903805 1 udp 2122262783 2001:e0:410:2448:7a05:9b11:66f2:c9e 42988 typ host generation 0 network-id 3 network-cost 900\r\na=ice-ufrag:4eKp\r\na=ice-pwd:D4sF5Pv9vx9ggaqxBlHbAFMx\r\na=ice-options:trickle renomination\r\na=mid:audio\r\na=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=sendrecv\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:Xm3YciqVIWFNSwy19e9MvfZ2YOdAZil7oT/tHjdf\r\na=rtpmap:102 AMR-WB/16000\r\na=fmtp:102 octet-align=0; mode-set=0,1,2; mode-change-capability=2\r\na=rtpmap:113 telephone-event/16000\r\n" - }, - "clientCorrelator": "fda6e26d-e7c8-4596-870c-c083c0d39b2c" - } - """ - Then the response status code should be 201 + And the header "registrationId" is set by default to the identifier of an existing active registration + And the request body is set by default to a request body compliant with the schema at "#/components/schemas/MediaSessionCreate" + +############################ Happy Path Scenarios ############################################# + + @webrtc_call_handling_createSession_01_regular_call_success + Scenario: Create a regular voice-video session + Given the request body property "$.originatorAddress" is set to the address associated with the registration + And the request body property "$.receiverAddress" is set to a valid reachable address + And the request body property "$.offer.sdp" is set to a valid SDP offer + And the request body property "$.callType" is set to "REGULAR" + When the request "createSession" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/MediaSessionInformation" - And the response body should contain a "mediaSessionId" + And the response body complies with the OAS schema at "#/components/schemas/MediaSessionResponse" + And the response property "$.originatorAddress" has the same value as the request body property "$.originatorAddress" + And the response property "$.receiverAddress" has the same value as the request body property "$.receiverAddress" + And a subsequent request "getSessionDetailsById" with the path parameter "mediaSessionId" set to the response property "$.mediaSessionId" returns response status code 200 - # Error scenarios + @webrtc_call_handling_createSession_02_emergency_call_with_location_success + Scenario: Create an emergency voice-video session with location details + Given the implementation supports callType "EMERGENCY" + And the request body property "$.originatorAddress" is set to the address associated with the registration + And the request body property "$.receiverAddress" is set to "urn:service:sos" + And the request body property "$.offer.sdp" is set to a valid SDP offer + And the request body property "$.callType" is set to "EMERGENCY" + And the request body property "$.locationDetails" is set to a valid value compliant with the schema at "#/components/schemas/LocationDetails" + When the request "createSession" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/MediaSessionResponse" + And the response property "$.receiverAddress" is "urn:service:sos" - # Generic 400 errors +############################ Error Scenarios ############################################# - @webrtc_call_handling_createSession_400.1_no_request_body + @webrtc_call_handling_createSession_400.01_schema_not_compliant + Scenario: Invalid Argument. Generic Syntax Exception + Given the request body is included but is not compliant with the schema at "#/components/schemas/MediaSessionCreate" + When the request "createSession" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_400.02_no_request_body Scenario: Missing request body Given the request body is not included - When the HTTP "POST" request is sent + When the request "createSession" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_createSession_400.2_empty_request_body + @webrtc_call_handling_createSession_400.03_empty_request_body Scenario: Empty object as request body - Given the request body is set to "{}" - When the HTTP "POST" request is sent + Given the request body is set to {} + When the request "createSession" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_400.04_missing_required_property + Scenario Outline: Error response for missing required property in request body + Given the request body property "" is not included + When the request "createSession" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + Examples: + | required_property | + | $.originatorAddress | + | $.receiverAddress | + | $.offer | - @webrtc_call_handling_createSession_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the request body is set to a valid request body - When the HTTP "POST" request is sent + @webrtc_call_handling_createSession_400.05_missing_registrationId_header + Scenario: Missing registrationId header + Given the header "registrationId" is not sent + When the request "createSession" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_400.06_invalid_registrationId_header + Scenario: registrationId header not compliant with the schema + Given the header "registrationId" is set to a value not compliant with the schema of parameter "registrationId" + When the request "createSession" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_400.07_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "createSession" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "createSession" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_createSession_401.2_expired_access_token - Scenario: Expired access token + @webrtc_call_handling_createSession_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the request body is set to a valid request body - When the HTTP "POST" request is sent + When the request "createSession" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_createSession_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_call_handling_createSession_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the request body is set to a valid request body - When the HTTP "POST" request is sent + When the request "createSession" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-call-handling:sessions:create" + When the request "createSession" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_createSession_422.01_calltype_emergency_not_supported + Scenario: Error response for callType EMERGENCY not supported + Given the implementation does not support callType "EMERGENCY" + And the request body property "$.callType" is set to "EMERGENCY" + When the request "createSession" is sent + Then the response status code is 422 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 422 + And the response property "$.code" is "WEBRTC_CALL_HANDLING.CALLTYPE_EMERGENCY_NOT_SUPPORTED" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-call-handling-deleteSessionById.feature b/code/Test_definitions/webrtc-call-handling-deleteSessionById.feature index ee7e46d..0fc7c97 100644 --- a/code/Test_definitions/webrtc-call-handling-deleteSessionById.feature +++ b/code/Test_definitions/webrtc-call-handling-deleteSessionById.feature @@ -1,81 +1,118 @@ Feature: CAMARA WebRTC Call Handling, vwip - Operation deleteSessionById + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # + # Testing assets: + # * An existing media session created by operation "createSession", or received through a session-invitation event, managed by the API client of the access token. + # * An access token emitted to a different API client, for the token mismatch scenario. + # + # References to OAS spec schemas refer to schemas specified in webrtc-call-handling.yaml + Background: Common deleteSessionById setup Given an environment at "apiRoot" - And the resource "/webrtc-call-handling/vwip/sessions/{mediaSessionId}" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-call-handling/vwip/sessions/{mediaSessionId}" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "mediaSessionId" is set by default to a existing register session + And the path parameter "mediaSessionId" is set by default to the identifier of an existing session + +############################ Happy Path Scenarios ############################################# @webrtc_call_handling_deleteSessionById_01_generic_success_scenario - Scenario: Cancel or terminate the media session - Given an existing voice-video session with "mediaSessionId" as "0AEE1B58BAEEDA3EABA42B32EBB3DFE07E9CFF402EAF9EED8EF" - And the path parameter "mediaSessionId" is set to the value for that voice-video session - When the client sends a DELETE request to "/sessions/0AEE1B58BAEEDA3EABA42B32EBB3DFE07E9CFF402EAF9EED8EF" - Then the response status code should be 204 + Scenario: Cancel or terminate an existing media session + Given an existing session created by operation "createSession" + And the path parameter "mediaSessionId" is set to the value of the identifier for that session + When the request "deleteSessionById" is sent + Then the response status code is 204 And the response header "x-correlator" has same value as the request header "x-correlator" + And a subsequent request "getSessionDetailsById" with the same path parameter "mediaSessionId" returns either response status code 404 or the response property "$.status" with value "Terminated" or "SessionCancelled" - # Error scenarios - - @webrtc_call_handling_deleteSessionById_404_session_not_found - Scenario: Session identifier cannot be matched to a device - Given the path parameter "mediaSessionId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "DELETE" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text - - # Generic 400 errors +############################ Error Scenarios ############################################# - @webrtc_call_handling_deleteSessionById_400.1_no_request - Scenario: Missing request path - Given the path parameter "mediaSessionId" is not included - When the HTTP "DELETE" request is sent + @webrtc_call_handling_deleteSessionById_400.01_invalid_mediaSessionId + Scenario: Path parameter mediaSessionId not compliant with the schema + Given the path parameter "mediaSessionId" is set to a value not compliant with the schema of parameter "mediaSessionId" + When the request "deleteSessionById" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_deleteSessionById_400.2_empty_request - Scenario: Empty object as request path - Given the path parameter "mediaSessionId" is set to "" - When the HTTP "DELETE" request is sent + @webrtc_call_handling_deleteSessionById_400.02_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "deleteSessionById" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors - - @webrtc_call_handling_deleteSessionById_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "mediaSessionId" is valid - When the HTTP "DELETE" request is sent + @webrtc_call_handling_deleteSessionById_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "deleteSessionById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_deleteSessionById_401.2_expired_access_token - Scenario: Expired access token + @webrtc_call_handling_deleteSessionById_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "mediaSessionId" is valid - When the HTTP "DELETE" request is sent + When the request "deleteSessionById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_deleteSessionById_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_call_handling_deleteSessionById_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "mediaSessionId" is valid - When the HTTP "DELETE" request is sent + When the request "deleteSessionById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_deleteSessionById_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-call-handling:sessions:delete" + When the request "deleteSessionById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_deleteSessionById_403.02_api_client_token_mismatch + Scenario: Session not created by the API client given in the access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not have rights to access/manage the session + When the request "deleteSessionById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_deleteSessionById_404.01_not_found + Scenario: Session not found + Given the path parameter "mediaSessionId" is set to a value compliant with the schema that does not identify an existing session + When the request "deleteSessionById" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-call-handling-getSessionDetailsById.feature b/code/Test_definitions/webrtc-call-handling-getSessionDetailsById.feature index bf91884..d228aec 100644 --- a/code/Test_definitions/webrtc-call-handling-getSessionDetailsById.feature +++ b/code/Test_definitions/webrtc-call-handling-getSessionDetailsById.feature @@ -1,83 +1,121 @@ Feature: CAMARA WebRTC Call Handling, vwip - Operation getSessionDetailsById + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # + # Testing assets: + # * An existing media session created by operation "createSession", or received through a session-invitation event, managed by the API client of the access token. + # * An access token emitted to a different API client, for the token mismatch scenario. + # + # References to OAS spec schemas refer to schemas specified in webrtc-call-handling.yaml + Background: Common getSessionDetailsById setup Given an environment at "apiRoot" - And the resource "/webrtc-call-handling/vwip/sessions/{mediaSessionId}" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-call-handling/vwip/sessions/{mediaSessionId}" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "mediaSessionId" is set by default to a existing register session + And the path parameter "mediaSessionId" is set by default to the identifier of an existing session + +############################ Happy Path Scenarios ############################################# @webrtc_call_handling_getSessionDetailsById_01_generic_success_scenario - Scenario: Get the media session information - Given an existing voice-video session with "mediaSessionId" as "0AEE1B58BAEEDA3EABA42B32EBB3DFE07E9CFF402EAF9EED8EF" - And the path parameter "mediaSessionId" is set to the value for that voice-video session - When the client sends a GET request to "/sessions/0AEE1B58BAEEDA3EABA42B32EBB3DFE07E9CFF402EAF9EED8EF" - Then the response status code should be 200 + Scenario: Retrieve an existing media session + Given an existing session created by operation "createSession" + And the path parameter "mediaSessionId" is set to the value of the identifier for that session + When the request "getSessionDetailsById" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/MediaSessionInformation" - - # Error scenarios - - @webrtc_call_handling_getSessionDetailsById_404_session_not_found - Scenario: Session identifier cannot be matched to an existing call - Given the path parameter "mediaSessionId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "GET" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text + And the response body complies with the OAS schema at "#/components/schemas/MediaSessionResponse" + And the response property "$.mediaSessionId" is the value of the path parameter "mediaSessionId" + And the response properties "$.originatorAddress" and "$.receiverAddress" have the same values as in the "createSession" request for that session - # Generic 400 errors +############################ Error Scenarios ############################################# - @webrtc_call_handling_getSessionDetailsById_400.1_no_request - Scenario: Missing request path - Given the path parameter "mediaSessionId" not included - When the HTTP "GET" request is sent + @webrtc_call_handling_getSessionDetailsById_400.01_invalid_mediaSessionId + Scenario: Path parameter mediaSessionId not compliant with the schema + Given the path parameter "mediaSessionId" is set to a value not compliant with the schema of parameter "mediaSessionId" + When the request "getSessionDetailsById" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_getSessionDetailsById_400.2_empty_request - Scenario: Empty object as request path - Given the request body is set to "{}" - And the path parameter "mediaSessionId" is set to "" - When the HTTP "GET" request is sent + @webrtc_call_handling_getSessionDetailsById_400.02_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "getSessionDetailsById" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors - - @webrtc_call_handling_getSessionDetailsById_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "mediaSessionId" is valid - When the HTTP "GET" request is sent + @webrtc_call_handling_getSessionDetailsById_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "getSessionDetailsById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_getSessionDetailsById_401.2_expired_access_token - Scenario: Expired access token + @webrtc_call_handling_getSessionDetailsById_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "mediaSessionId" is valid - When the HTTP "GET" request is sent + When the request "getSessionDetailsById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_getSessionDetailsById_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_call_handling_getSessionDetailsById_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "mediaSessionId" is valid - When the HTTP "GET" request is sent + When the request "getSessionDetailsById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_getSessionDetailsById_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-call-handling:sessions:read" + When the request "getSessionDetailsById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_getSessionDetailsById_403.02_api_client_token_mismatch + Scenario: Session not created by the API client given in the access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not have rights to access/manage the session + When the request "getSessionDetailsById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_getSessionDetailsById_404.01_not_found + Scenario: Session not found + Given the path parameter "mediaSessionId" is set to a value compliant with the schema that does not identify an existing session + When the request "getSessionDetailsById" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-call-handling-updateSessionStatus.feature b/code/Test_definitions/webrtc-call-handling-updateSessionStatus.feature index 5d3fd7d..f69cb47 100644 --- a/code/Test_definitions/webrtc-call-handling-updateSessionStatus.feature +++ b/code/Test_definitions/webrtc-call-handling-updateSessionStatus.feature @@ -1,82 +1,210 @@ Feature: CAMARA WebRTC Call Handling, vwip - Operation updateSessionStatus + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # + # Testing assets: + # * An existing media session created by operation "createSession", or received through a session-invitation event, managed by the API client of the access token. + # * An access token emitted to a different API client, for the token mismatch scenario. + # + # References to OAS spec schemas refer to schemas specified in webrtc-call-handling.yaml + Background: Common updateSessionStatus setup Given an environment at "apiRoot" - And the resource "/webrtc-call-handling/vwip/sessions/{mediaSessionId}/status" | + And the resource "/webrtc-call-handling/vwip/sessions/{mediaSessionId}/status" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "mediaSessionId" is set by default to a existing register session - - @webrtc_call_handling_updateSessionStatus_01_generic_success_scenario - Scenario: Update the status of the voice-video session - Given an existing voice-video session with "mediaSessionId" as "0AEE1B58BAEEDA3EABA42B32EBB3DFE07E9CFF402EAF9EED8EF" - And the path parameter "mediaSessionId" is set to the value for that voice-video session - When the client sends a PUT request to "/sessions/0AEE1B58BAEEDA3EABA42B32EBB3DFE07E9CFF402EAF9EED8EF/status" - Then the response status code should be 200 + And the path parameter "mediaSessionId" is set by default to the identifier of an existing session + And the request body is set by default to a request body compliant with the schema at "#/components/schemas/MediaSessionStatusChange" + +############################ Happy Path Scenarios ############################################# + + @webrtc_call_handling_updateSessionStatus_01_connected_with_answer + Scenario: Accept an incoming session with status Connected and an SDP answer + Given an existing incoming session in which the API client is the receiving party and the session is not yet connected + And the path parameter "mediaSessionId" is set to the value of the identifier for that session + And the request body property "$.status" is set to "Connected" + And the request body property "$.answer.sdp" is set to a valid SDP answer + When the request "updateSessionStatus" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/MediaSessionInformation" + And the response body complies with the OAS schema at "#/components/schemas/MediaSessionResponse" + And the response property "$.status" is "Connected" + And the response property "$.answer.sdp" has the same value as the request body property "$.answer.sdp" + And a subsequent request "getSessionDetailsById" with the same path parameter "mediaSessionId" returns the response property "$.status" with value "Connected" - # Error scenarios + @webrtc_call_handling_updateSessionStatus_02_ringing_without_sdp + Scenario: Notify that the receiving endpoint is ringing without SDP + Given an existing incoming session in which the API client is the receiving party and the session is not yet connected + And the path parameter "mediaSessionId" is set to the value of the identifier for that session + And the request body is set to {"status": "Ringing"} + When the request "updateSessionStatus" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/MediaSessionResponse" + And the response property "$.status" is "Ringing" - @webrtc_call_handling_updateSessionStatus_404_session_not_found - Scenario: Session identifier cannot be matched to an existing call - Given the path parameter "mediaSessionId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "PUT" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" + @webrtc_call_handling_updateSessionStatus_03_no_change_returns_current_session + Scenario: Update without changes returns the current session + Given an existing session + And the path parameter "mediaSessionId" is set to the value of the identifier for that session + And the request body property "$.status" is set to the current status of that session + And the request body properties "$.offer" and "$.answer" are not included + When the request "updateSessionStatus" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/MediaSessionResponse" + And the response body is the same as the response of a "getSessionDetailsById" request for that session sent before the update + +############################ Error Scenarios ############################################# + + @webrtc_call_handling_updateSessionStatus_400.01_schema_not_compliant + Scenario: Invalid Argument. Generic Syntax Exception + Given the request body is included but is not compliant with the schema at "#/components/schemas/MediaSessionStatusChange" + When the request "updateSessionStatus" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_updateSessionStatus_400.02_no_request_body + Scenario: Missing request body + Given the request body is not included + When the request "updateSessionStatus" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_updateSessionStatus_400.03_empty_request_body + Scenario: Empty object as request body + Given the request body is set to {} + When the request "updateSessionStatus" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_updateSessionStatus_400.04_missing_required_property + Scenario Outline: Error response for missing required property in request body + Given the request body property "" is not included + When the request "updateSessionStatus" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 400 errors + Examples: + | required_property | + | $.status | - @webrtc_call_handling_updateSessionStatus_400.1_no_request_body - Scenario: Missing request path - Given the path parameter "mediaSessionId" is not included - When the HTTP "PUT" request is sent + @webrtc_call_handling_updateSessionStatus_400.05_invalid_status + Scenario: Request body property status not compliant with the schema + Given the request body property "$.status" is set to a value not included in the enum of the schema at "#/components/schemas/SessionStatus" + When the request "updateSessionStatus" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_updateSessionStatus_400.2_empty_request_body - Scenario: Empty object as request path - Given the path parameter "mediaSessionId" set to "" - When the HTTP "PUT" request is sent + @webrtc_call_handling_updateSessionStatus_400.06_invalid_mediaSessionId + Scenario: Path parameter mediaSessionId not compliant with the schema + Given the path parameter "mediaSessionId" is set to a value not compliant with the schema of parameter "mediaSessionId" + When the request "updateSessionStatus" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + @webrtc_call_handling_updateSessionStatus_400.07_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "updateSessionStatus" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text - @webrtc_call_handling_updateSessionStatus_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "mediaSessionId" is valid - When the HTTP "PUT" request is sent + @webrtc_call_handling_updateSessionStatus_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "updateSessionStatus" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_updateSessionStatus_401.2_expired_access_token - Scenario: Expired access token + @webrtc_call_handling_updateSessionStatus_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "mediaSessionId" is valid - When the HTTP "PUT" request is sent + When the request "updateSessionStatus" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_call_handling_updateSessionStatus_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_call_handling_updateSessionStatus_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "mediaSessionId" is valid - When the HTTP "PUT" request is sent + When the request "updateSessionStatus" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_updateSessionStatus_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-call-handling:sessions:write" + When the request "updateSessionStatus" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_updateSessionStatus_403.02_api_client_token_mismatch + Scenario: Session not created by the API client given in the access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not have rights to access/manage the session + When the request "updateSessionStatus" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_call_handling_updateSessionStatus_404.01_not_found + Scenario: Session not found + Given the path parameter "mediaSessionId" is set to a value compliant with the schema that does not identify an existing session + When the request "updateSessionStatus" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-events-subscriptions-createNotificationChannelSubscription.feature b/code/Test_definitions/webrtc-events-subscriptions-createNotificationChannelSubscription.feature index 85ce878..e42a014 100644 --- a/code/Test_definitions/webrtc-events-subscriptions-createNotificationChannelSubscription.feature +++ b/code/Test_definitions/webrtc-events-subscriptions-createNotificationChannelSubscription.feature @@ -1,90 +1,340 @@ Feature: CAMARA WebRTC Events Subscriptions, vwip - Operation createNotificationChannelSubscription + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Whether subscriptions are created synchronously (201), asynchronously (202) or both + # * Whether multi-event subscriptions are supported + # * Access token type (2-legged or 3-legged) agreed during onboarding + # + # Testing assets: + # * A sink URL identified as "callbackUrl", which receives notifications + # * A deviceId with an active WebRTC registration created by operation "createRegistration" of webrtc-registration + # + # References to OAS spec schemas refer to schemas specified in webrtc-events-subscriptions.yaml Background: Common createNotificationChannelSubscription setup Given an environment at "apiRoot" - And the resource "/webrtc-events-subscriptions/vwip/subscriptions" | + And the resource "/webrtc-events-subscriptions/vwip/subscriptions" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the request body is set by default to a request body compliant with the schema at "/components/schemas/SubscriptionRequest" - # Properties not explicitly overwritten in the Scenarios can take any values compliant with the schema - - @webrtc_events_createNotificationChannelSubscription_01_generic_success_scenario - Scenario: Create a webrtc-events-subscriptions event subscription - When the client sends a POST request to "/subscriptions" with the following payload: - """ - { - "protocol": "HTTP", - "sink": "https://notificationServer.opentelco.com", - "types": [ - "org.camaraproject.webrtc-events-subscriptions.v0.session-invitation" - ], - "config": { - "subscriptionDetail": { - "deviceId": "7d444840-9dc0-11d1-b245-5ffdce74fad2", - "registrationId": "xsmcaum3z4zw4l0cu4w115m0" - }, - "initialEvent": true, - "subscriptionMaxEvents": 50, - "subscriptionExpireTime": "2024-11-17T13:18:23.682Z" - } - } - """ - Then the response status code should be 201 or 202 - And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/Subscription" - - # Error scenarios - - # Generic 400 errors - - @webrtc_events_createNotificationChannelSubscription_400.1_no_request_body + And the request body is set by default to a request body compliant with the schema at "#/components/schemas/SubscriptionRequest" + And the request body property "$.sink" is set to "callbackUrl" + And the request body property "$.config.subscriptionDetail.deviceId" is set to the testing asset deviceId + And the request body properties "$.config.initialEvent" and "$.config.subscriptionMaxEvents" are not included + +############################ Happy Path Scenarios ############################################# + + @webrtc_events_subscriptions_createNotificationChannelSubscription_01_sync_creation + Scenario Outline: Create a subscription synchronously for event type + Given that subscriptions are created synchronously + And the request body property "$.types" is set to [""] + And the request body property "$.config.subscriptionExpireTime" is set to a date-time in the future + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/Subscription" + And the response property "$.types[0]" is "" + And the response property "$.config.subscriptionDetail.deviceId" is the testing asset deviceId + + Examples: + | event_type | + | org.camaraproject.webrtc-events-subscriptions.v0.session-invitation | + | org.camaraproject.webrtc-events-subscriptions.v0.session-status | + | org.camaraproject.webrtc-events-subscriptions.v0.registration-ends | + + @webrtc_events_subscriptions_createNotificationChannelSubscription_02_async_creation + Scenario: Create a subscription asynchronously + Given that subscriptions are created asynchronously + And the request body property "$.types" is set to ["org.camaraproject.webrtc-events-subscriptions.v0.session-invitation"] + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 202 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/SubscriptionAsync" + + @webrtc_events_subscriptions_createNotificationChannelSubscription_03_accesstoken_sink_credential + Scenario: Create a subscription synchronously with ACCESSTOKEN sinkCredential + Given that subscriptions are created synchronously + And the request body property "$.sinkCredential.credentialType" is set to "ACCESSTOKEN" + And the request body property "$.sinkCredential.accessTokenType" is set to "bearer" + And the request body property "$.sinkCredential.accessToken" is set to a valid access token + And the request body property "$.sinkCredential.accessTokenExpiresUtc" is set to a date-time in the future + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/Subscription" + + @webrtc_events_subscriptions_createNotificationChannelSubscription_04_subscription_ended_on_expiry + Scenario: Receive subscription-ended notification on expiry + Given an existing subscription created by operation "createNotificationChannelSubscription" with "$.config.subscriptionExpireTime" set in the near future + When the subscription expire time is reached + Then the event notification "org.camaraproject.webrtc-events-subscriptions.v0.subscription-ended" is received on "callbackUrl" + And the notification body complies with the OAS schema at "#/components/schemas/EventSubscriptionEnded" + And the notification property "$.data.terminationReason" is "SUBSCRIPTION_EXPIRED" + +############################ Error Scenarios ############################################# + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.01_schema_not_compliant + Scenario: Invalid Argument. Generic Syntax Exception + Given the request body is included but is not compliant with the schema at "#/components/schemas/SubscriptionRequest" + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.02_no_request_body Scenario: Missing request body Given the request body is not included - When the HTTP "POST" request is sent + When the request "createNotificationChannelSubscription" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_events_createNotificationChannelSubscription_400.2_empty_request_body + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.03_empty_request_body Scenario: Empty object as request body - Given the request body is set to "{}" - When the HTTP "POST" request is sent + Given the request body is set to {} + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.04_missing_required_property + Scenario Outline: Error response for missing required property in request body + Given the request body property "" is not included + When the request "createNotificationChannelSubscription" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + Examples: + | required_property | + | $.protocol | + | $.sink | + | $.types | + | $.config | + | $.config.subscriptionDetail | + | $.config.subscriptionDetail.deviceId | + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.05_invalid_event_type + Scenario: Subscription creation with invalid event type + Given the request body property "$.types" is set to ["org.camaraproject.webrtc-events-subscriptions.v0.unknown-event"] + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.06_expire_time_in_past + Scenario: Subscription creation with expire time in the past + Given the request body property "$.config.subscriptionExpireTime" is set to a date-time in the past + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.07_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.08_out_of_range + Scenario: Subscription creation with expire time beyond the allowed range + Given the request body property "$.config.subscriptionExpireTime" is set to a date-time beyond the maximum subscription duration allowed by the implementation + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "OUT_OF_RANGE" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.09_invalid_protocol + Scenario: Subscription creation with invalid protocol + Given the request body property "$.protocol" is not set to "HTTP" + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_PROTOCOL" + And the response property "$.message" contains a user friendly text - @webrtc_events_createNotificationChannelSubscription_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the request body is set to a valid request body - When the HTTP "POST" request is sent + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.10_invalid_credential + Scenario: Subscription creation with invalid credential type + Given the request body property "$.sinkCredential.credentialType" is not set to "ACCESSTOKEN" + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_CREDENTIAL" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.11_invalid_token + Scenario: Subscription creation with invalid sink credential token + Given the request body property "$.sinkCredential.credentialType" is set to "ACCESSTOKEN" + And the request body property "$.sinkCredential.accessTokenType" is not set to "bearer" + And the request body property "$.sinkCredential.accessToken" is set to a valid access token + And the request body property "$.sinkCredential.accessTokenExpiresUtc" is set to a date-time in the future + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_TOKEN" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_400.12_invalid_sink + Scenario: Subscription creation with invalid sink + Given the request body property "$.sink" is set to a URL not valid for the specified protocol + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_SINK" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "createNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_createNotificationChannelSubscription_401.2_expired_access_token - Scenario: Expired access token + @webrtc_events_subscriptions_createNotificationChannelSubscription_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the request body is set to a valid request body - When the HTTP "POST" request is sent + When the request "createNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_createNotificationChannelSubscription_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_events_subscriptions_createNotificationChannelSubscription_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the request body is set to a valid request body - When the HTTP "POST" request is sent + When the request "createNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_403.01_missing_access_token_scope + Scenario Outline: Missing access token scope for event type + Given the request body property "$.types" is set to ["org.camaraproject.webrtc-events-subscriptions.v0."] + And the header "Authorization" is set to an access token that does not include scope "webrtc-events-subscriptions:org.camaraproject.webrtc-events-subscriptions.v0.:create" + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + Examples: + | event_type | + | session-invitation | + | session-status | + | registration-ends | + + @webrtc_events_subscriptions_createNotificationChannelSubscription_409.01_already_exists + Scenario: Conflict due to an existing subscription + Given an existing subscription with the same "$.types", "$.sink" and "$.config.subscriptionDetail.deviceId" as the request body + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 409 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 409 + And the response property "$.code" is "ALREADY_EXISTS" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_409.02_aborted + Scenario: Conflict due to a subscription being modified + Given a subscription with the same "$.types" and "$.config.subscriptionDetail.deviceId" as the request body is being modified by another request + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 409 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 409 + And the response property "$.code" is "ABORTED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_422.01_service_not_applicable + Scenario: Service not applicable for the provided deviceId + Given the request body property "$.config.subscriptionDetail.deviceId" is set to a deviceId without an active WebRTC registration + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 422 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 422 + And the response property "$.code" is "SERVICE_NOT_APPLICABLE" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_422.02_multievent_not_supported + Scenario: Multi-event subscription not supported + Given the implementation only allows one event type per subscription + And the request body property "$.types" is set to an array with 2 valid event types + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 422 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 422 + And the response property "$.code" is "MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_422.03_multievent_combination_not_supported + Scenario: Multi-event combination temporarily not supported + Given the implementation supports multi-event subscriptions + And the request body property "$.types" is set to a combination of event types temporarily not supported by the implementation + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 422 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 422 + And the response property "$.code" is "MULTIEVENT_COMBINATION_TEMPORARILY_NOT_SUPPORTED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_createNotificationChannelSubscription_429.01_too_many_requests + Scenario: Request is rejected due to threshold policy + Given the threshold of requests has been reached + When the request "createNotificationChannelSubscription" is sent + Then the response status code is 429 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 429 + And the response property "$.code" is "TOO_MANY_REQUESTS" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-events-subscriptions-deleteNotificationChannelSubscription.feature b/code/Test_definitions/webrtc-events-subscriptions-deleteNotificationChannelSubscription.feature index 8829a02..35250d3 100644 --- a/code/Test_definitions/webrtc-events-subscriptions-deleteNotificationChannelSubscription.feature +++ b/code/Test_definitions/webrtc-events-subscriptions-deleteNotificationChannelSubscription.feature @@ -1,82 +1,151 @@ Feature: CAMARA WebRTC Events Subscriptions, vwip - Operation deleteNotificationChannelSubscription + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Whether subscriptions are deleted synchronously (204), asynchronously (202) or both + # * Access token type (2-legged or 3-legged) agreed during onboarding + # + # Testing assets: + # * A sink URL identified as "callbackUrl", which receives notifications + # * A subscription created by operation "createNotificationChannelSubscription" with "$.sink" set to "callbackUrl" + # + # References to OAS spec schemas refer to schemas specified in webrtc-events-subscriptions.yaml Background: Common deleteNotificationChannelSubscription setup Given an environment at "apiRoot" - And the resource "/webrtc-events-subscriptions/vwip/subscriptions/{subscriptionId}" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-events-subscriptions/vwip/subscriptions/{subscriptionId}" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "subscriptionId" is set by default to a existing register session - # Properties not explicitly overwitten in the Scenarios can take any values compliant with the schema + And the path parameter "subscriptionId" is set by default to the identifier of an existing subscription - @webrtc_events_deleteNotificationChannelSubscription_01_generic_success_scenario - Scenario: Delete a webrtc-events-subscriptions event subscription - Given an existing events subscription with "subscriptionId" as "qs15-h556-rt89-1298" - And the path parameter "subscriptionId" is set to the value for that subscription - When the client sends a DELETE request to "/subscriptions/qs15-h556-rt89-1298" - Then the response status code should be 202 or 204 +############################ Happy Path Scenarios ############################################# + + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_01_sync_deletion + Scenario: Delete an existing subscription synchronously + Given that subscriptions are deleted synchronously + And an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + When the request "deleteNotificationChannelSubscription" is sent + Then the response status code is 204 And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body is not available - # Error scenarios + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_02_async_deletion + Scenario: Delete an existing subscription asynchronously + Given that subscriptions are deleted asynchronously + And an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + When the request "deleteNotificationChannelSubscription" is sent + Then the response status code is 202 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/SubscriptionAsync" - @webrtc_events_deleteNotificationChannelSubscription_404_subscription_not_found - Scenario: Identifier cannot be matched to a subscription - Given the path parameter "subscriptionId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "DELETE" request is sent + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_03_not_found_after_deletion + Scenario: Deleted subscription cannot be retrieved + Given an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + And the request "deleteNotificationChannelSubscription" has been sent and the deletion has been completed + When the request "retrieveNotificationChannelSubscription" is sent Then the response status code is 404 And the response property "$.status" is 404 And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text - # Generic 400 errors + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_04_subscription_ended_on_deletion + Scenario: Receive subscription-ended notification on deletion + Given an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + When the request "deleteNotificationChannelSubscription" is sent + Then the response status code is 202 or 204 + And the event notification "org.camaraproject.webrtc-events-subscriptions.v0.subscription-ended" is received on "callbackUrl" + And the notification body complies with the OAS schema at "#/components/schemas/EventSubscriptionEnded" + And the notification property "$.data.terminationReason" is "SUBSCRIPTION_DELETED" - @webrtc_events_deleteNotificationChannelSubscription_400.1_no_request - Scenario: Missing request path parameter - Given the path parameter "subscriptionId" is not included - When the HTTP "DELETE" request is sent +############################ Error Scenarios ############################################# + + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_400.01_invalid_path_parameter + Scenario: Path parameter subscriptionId not compliant with the schema + Given the path parameter "subscriptionId" is set to a value not compliant with the schema at "#/components/schemas/SubscriptionId" + When the request "deleteNotificationChannelSubscription" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_events_deleteNotificationChannelSubscription_400.2_empty_request - Scenario: Empty object as request path parameter - Given the path parameter "subscriptionId" is set to "" - When the HTTP "DELETE" request is sent + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_400.02_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "deleteNotificationChannelSubscription" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors - - @webrtc_events_deleteNotificationChannelSubscription_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "subscriptionId" is valid - When the HTTP "DELETE" request is sent + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "deleteNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_deleteNotificationChannelSubscription_401.2_expired_access_token - Scenario: Expired access token + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "subscriptionId" is valid - When the HTTP "DELETE" request is sent + When the request "deleteNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_deleteNotificationChannelSubscription_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "subscriptionId" is valid - When the HTTP "DELETE" request is sent + When the request "deleteNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-events-subscriptions:delete" + When the request "deleteNotificationChannelSubscription" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_403.02_api_client_token_mismatch + Scenario: Subscription not created by the API client given in the access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not create the subscription + When the request "deleteNotificationChannelSubscription" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_deleteNotificationChannelSubscription_404.01_not_found + Scenario: Non-existing subscriptionId + Given the path parameter "subscriptionId" is set to a value compliant with the schema that does not identify an existing subscription + When the request "deleteNotificationChannelSubscription" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscription.feature b/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscription.feature index 74f1364..fe0d3eb 100644 --- a/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscription.feature +++ b/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscription.feature @@ -1,83 +1,120 @@ Feature: CAMARA WebRTC Events Subscriptions, vwip - Operation retrieveNotificationChannelSubscription + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type (2-legged or 3-legged) agreed during onboarding + # + # Testing assets: + # * A subscription created by operation "createNotificationChannelSubscription" + # + # References to OAS spec schemas refer to schemas specified in webrtc-events-subscriptions.yaml Background: Common retrieveNotificationChannelSubscription setup Given an environment at "apiRoot" - And the resource "/webrtc-events-subscriptions/vwip/subscriptions/{subscriptionId}" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-events-subscriptions/vwip/subscriptions/{subscriptionId}" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "subscriptionId" is set by default to a existing register session - # Properties not explicitly overwitten in the Scenarios can take any values compliant with the schema + And the path parameter "subscriptionId" is set by default to the identifier of an existing subscription - @webrtc_events_retrieveNotificationChannelSubscription_01_generic_success_scenario - Scenario: Retrieve a webrtc-events-subscriptions event subscription - Given an existing events subscription with "subscriptionId" as "qs15-h556-rt89-1298" - And the path parameter "subscriptionId" is set to the value for that voice-video session - When the client sends a GET request to "/subscriptions/qs15-h556-rt89-1298" - Then the response status code should be 200 - And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/Subscription" - - # Error scenarios +############################ Happy Path Scenarios ############################################# - @webrtc_events_retrieveNotificationChannelSubscription_404_subscription_not_found - Scenario: Identifier cannot be matched to a subscription - Given the path parameter "subscriptionId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "GET" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_01_generic_success_scenario + Scenario: Retrieve an existing subscription + Given an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + When the request "retrieveNotificationChannelSubscription" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/Subscription" + And the response property "$.id" is the value of the path parameter "subscriptionId" + And the response properties "$.types", "$.sink" and "$.config.subscriptionDetail" have the values of the subscription creation request - # Generic 400 errors +############################ Error Scenarios ############################################# - @webrtc_events_retrieveNotificationChannelSubscription_400.1_no_request - Scenario: Missing request path parameter - Given the path parameter "subscriptionId" is not included - When the HTTP "GET" request is sent + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_400.01_invalid_path_parameter + Scenario: Path parameter subscriptionId not compliant with the schema + Given the path parameter "subscriptionId" is set to a value not compliant with the schema at "#/components/schemas/SubscriptionId" + When the request "retrieveNotificationChannelSubscription" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_events_retrieveNotificationChannelSubscription_400.2_empty_request - Scenario: Empty object as request path parameter - Given the path parameter "subscriptionId" is set to "" - When the HTTP "GET" request is sent + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_400.02_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "retrieveNotificationChannelSubscription" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors - - @webrtc_events_retrieveNotificationChannelSubscription_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "subscriptionId" is valid - When the HTTP "GET" request is sent + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "retrieveNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_retrieveNotificationChannelSubscription_401.2_expired_access_token - Scenario: Expired access token + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "subscriptionId" is valid - When the HTTP "GET" request is sent + When the request "retrieveNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_retrieveNotificationChannelSubscription_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "subscriptionId" is valid - When the HTTP "GET" request is sent + When the request "retrieveNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-events-subscriptions:read" + When the request "retrieveNotificationChannelSubscription" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_403.02_api_client_token_mismatch + Scenario: Subscription not created by the API client given in the access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not create the subscription + When the request "retrieveNotificationChannelSubscription" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_retrieveNotificationChannelSubscription_404.01_not_found + Scenario: Non-existing subscriptionId + Given the path parameter "subscriptionId" is set to a value compliant with the schema that does not identify an existing subscription + When the request "retrieveNotificationChannelSubscription" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscriptionList.feature b/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscriptionList.feature index 2709a58..a3dc5b2 100644 --- a/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscriptionList.feature +++ b/code/Test_definitions/webrtc-events-subscriptions-retrieveNotificationChannelSubscriptionList.feature @@ -1,52 +1,93 @@ Feature: CAMARA WebRTC Events Subscriptions, vwip - Operation retrieveNotificationChannelSubscriptionList + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type (2-legged or 3-legged) agreed during onboarding + # + # Testing assets: + # * An API client able to create subscriptions with operation "createNotificationChannelSubscription" + # + # References to OAS spec schemas refer to schemas specified in webrtc-events-subscriptions.yaml Background: Common retrieveNotificationChannelSubscriptionList setup Given an environment at "apiRoot" - And the resource "/webrtc-events-subscriptions/vwip/subscriptions" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-events-subscriptions/vwip/subscriptions" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "subscriptionId" is set by default to a existing register session - # Properties not explicitly overwitten in the Scenarios can take any values compliant with the schema - @webrtc_events_retrieveNotificationChannelSubscriptionList_01_generic_success_scenario - Scenario: Retrieve a list of webrtc-events-subscriptions event subscription - When the client sends a GET request to "/subscriptions" - Then the response status code should be 200 +############################ Happy Path Scenarios ############################################# + + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_01_generic_success_scenario + Scenario: Retrieve the list of existing subscriptions + Given at least an existing subscription created by operation "createNotificationChannelSubscription" + When the request "retrieveNotificationChannelSubscriptionList" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body is an array whose items comply with the OAS schema at "#/components/schemas/Subscription" + And the response body includes an item whose property "$.id" is the identifier of that subscription + + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_02_empty_response + Scenario: No existing subscriptions + Given no subscriptions have been created by operation "createNotificationChannelSubscription" for the API client + When the request "retrieveNotificationChannelSubscriptionList" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And each item of the the response array, if any, complies with the OAS schema at "/components/schemas/Subscription" + And the response body is an empty array "[]" - # Error scenarios +############################ Error Scenarios ############################################# - # Generic 401 errors + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_400.01_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "retrieveNotificationChannelSubscriptionList" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text - @webrtc_events_retrieveNotificationChannelSubscriptionList_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the request body is set to a valid request body - When the HTTP "GET" request is sent + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "retrieveNotificationChannelSubscriptionList" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_retrieveNotificationChannelSubscriptionList_401.2_expired_access_token - Scenario: Expired access token + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the request body is set to a valid request body - When the HTTP "GET" request is sent + When the request "retrieveNotificationChannelSubscriptionList" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_retrieveNotificationChannelSubscriptionList_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the request body is set to a valid request body - When the HTTP "GET" request is sent + When the request "retrieveNotificationChannelSubscriptionList" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_retrieveNotificationChannelSubscriptionList_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-events-subscriptions:read" + When the request "retrieveNotificationChannelSubscriptionList" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-events-subscriptions-updateNotificationChannelSubscription.feature b/code/Test_definitions/webrtc-events-subscriptions-updateNotificationChannelSubscription.feature index e3cee8b..4b6f4c7 100644 --- a/code/Test_definitions/webrtc-events-subscriptions-updateNotificationChannelSubscription.feature +++ b/code/Test_definitions/webrtc-events-subscriptions-updateNotificationChannelSubscription.feature @@ -1,97 +1,234 @@ Feature: CAMARA WebRTC Events Subscriptions, vwip - Operation updateNotificationChannelSubscription + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type (2-legged or 3-legged) agreed during onboarding + # + # Testing assets: + # * A subscription created by operation "createNotificationChannelSubscription" + # + # References to OAS spec schemas refer to schemas specified in webrtc-events-subscriptions.yaml Background: Common updateNotificationChannelSubscription setup Given an environment at "apiRoot" - And the resource "/webrtc-events-subscriptions/vwip/subscriptions/{subscriptionId}" | + And the resource "/webrtc-events-subscriptions/vwip/subscriptions/{subscriptionId}" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "subscriptionId" is set by default to a existing register session - And the request body is set by default to a request body compliant with the schema at "/components/schemas/SubscriptionUpdateRequest" - # Properties not explicitly overwitten in the Scenarios can take any values compliant with the schema - - @webrtc_events_updateNotificationChannelSubscription_01_generic_success_scenario - Scenario: Update a webrtc-events-subscriptions event subscription - Given an existing events subscription with "subscriptionId" as "qs15-h556-rt89-1298" - And the path parameter "subscriptionId" is set to the value for that voice-video session - When the client sends a PUT request to "/subscriptions/qs15-h556-rt89-1298" with the following payload: - """ - { - "sinkCredential": { - "credentialType": "ACCESSTOKEN", - "accessToken": "c400a020eda54c37a54ea578f8d94748", - "accessTokenExpiresUtc": "2026-01-16T15:16:00.000Z", - "accessTokenType": "bearer" - } - } - """ - Then the response status code should be 200 - And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/Subscription" - - # Error scenarios - - @webrtc_events_updateNotificationChannelSubscription_404_subscription_not_found - Scenario: Identifier cannot be matched to a subscription - Given the path parameter "subscriptionId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "PUT" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text + And the request body is set by default to a request body compliant with the schema at "#/components/schemas/SubscriptionUpdateRequest" + And the path parameter "subscriptionId" is set by default to the identifier of an existing subscription + +############################ Happy Path Scenarios ############################################# + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_01_update_expire_time + Scenario: Update the subscription expire time + Given an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + And the request body property "$.config.subscriptionExpireTime" is set to a date-time in the future different from the current one + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/Subscription" + And the response property "$.id" is the value of the path parameter "subscriptionId" + And the response property "$.config.subscriptionExpireTime" is the value of the request body property "$.config.subscriptionExpireTime" + And the response properties "$.types", "$.sink" and "$.config.subscriptionDetail" are unchanged + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_02_update_sink_credential + Scenario: Update the subscription sinkCredential + Given an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + And the request body property "$.sinkCredential.credentialType" is set to "ACCESSTOKEN" + And the request body property "$.sinkCredential.accessTokenType" is set to "bearer" + And the request body property "$.sinkCredential.accessToken" is set to a valid access token + And the request body property "$.sinkCredential.accessTokenExpiresUtc" is set to a date-time in the future + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/Subscription" + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_03_update_reflected_on_retrieval + Scenario: Updated subscription is returned by retrieval + Given an existing subscription created by operation "createNotificationChannelSubscription" + And the path parameter "subscriptionId" is set to the value of "$.id" for that subscription + And the request "updateNotificationChannelSubscription" has been sent with "$.config.subscriptionExpireTime" set to a date-time in the future and the response status code is 200 + When the request "retrieveNotificationChannelSubscription" is sent + Then the response status code is 200 + And the response body complies with the OAS schema at "#/components/schemas/Subscription" + And the response property "$.config.subscriptionExpireTime" is the value sent in the update request + +############################ Error Scenarios ############################################# - # Generic 400 errors + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.01_schema_not_compliant + Scenario: Invalid Argument. Generic Syntax Exception + Given the request body is included but is not compliant with the schema at "#/components/schemas/SubscriptionUpdateRequest" + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text - @webrtc_events_updateNotificationChannelSubscription_400.1_no_request_body + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.02_no_request_body Scenario: Missing request body Given the request body is not included - When the HTTP "PUT" request is sent + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.03_non_updatable_property + Scenario Outline: Request body with a property that cannot be updated + Given the request body property "" is set to a value compliant with the schema at "#/components/schemas/SubscriptionRequest" + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + Examples: + | property | + | $.sink | + | $.types | + | $.config.subscriptionDetail | + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.04_expire_time_in_past + Scenario: Update with expire time in the past + Given the request body property "$.config.subscriptionExpireTime" is set to a date-time in the past + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.05_invalid_path_parameter + Scenario: Path parameter subscriptionId not compliant with the schema + Given the path parameter "subscriptionId" is set to a value not compliant with the schema at "#/components/schemas/SubscriptionId" + When the request "updateNotificationChannelSubscription" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_events_updateNotificationChannelSubscription_400.2_empty_request_body - Scenario: Empty object as request body - Given the request body is set to "{}" - When the HTTP "PUT" request is sent + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.06_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "updateNotificationChannelSubscription" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.07_out_of_range + Scenario: Update with expire time beyond the allowed range + Given the request body property "$.config.subscriptionExpireTime" is set to a date-time beyond the maximum subscription duration allowed by the implementation + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "OUT_OF_RANGE" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.08_invalid_credential + Scenario: Update with invalid credential type + Given the request body property "$.sinkCredential.credentialType" is not set to "ACCESSTOKEN" + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_CREDENTIAL" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_400.09_invalid_token + Scenario: Update with invalid sink credential token + Given the request body property "$.sinkCredential.credentialType" is set to "ACCESSTOKEN" + And the request body property "$.sinkCredential.accessTokenType" is not set to "bearer" + And the request body property "$.sinkCredential.accessToken" is set to a valid access token + And the request body property "$.sinkCredential.accessTokenExpiresUtc" is set to a date-time in the future + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_TOKEN" + And the response property "$.message" contains a user friendly text - @webrtc_events_updateNotificationChannelSubscription_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "subscriptionId" is valid - And the request body is set to a valid request body - When the HTTP "PUT" request is sent + @webrtc_events_subscriptions_updateNotificationChannelSubscription_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "updateNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_updateNotificationChannelSubscription_401.2_expired_access_token - Scenario: Expired access token + @webrtc_events_subscriptions_updateNotificationChannelSubscription_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "subscriptionId" is valid - And the request body is set to a valid request body - When the HTTP "PUT" request is sent + When the request "updateNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_events_updateNotificationChannelSubscription_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_events_subscriptions_updateNotificationChannelSubscription_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "subscriptionId" is valid - And the request body is set to a valid request body - When the HTTP "PUT" request is sent + When the request "updateNotificationChannelSubscription" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-events-subscriptions:update" + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_404.01_not_found + Scenario: Non-existing subscriptionId + Given the path parameter "subscriptionId" is set to a value compliant with the schema that does not identify an existing subscription + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text + + @webrtc_events_subscriptions_updateNotificationChannelSubscription_429.01_too_many_requests + Scenario: Request is rejected due to threshold policy + Given the threshold of requests has been reached + When the request "updateNotificationChannelSubscription" is sent + Then the response status code is 429 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 429 + And the response property "$.code" is "TOO_MANY_REQUESTS" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-registration-createRegistration.feature b/code/Test_definitions/webrtc-registration-createRegistration.feature index ce21b5f..5442b8d 100644 --- a/code/Test_definitions/webrtc-registration-createRegistration.feature +++ b/code/Test_definitions/webrtc-registration-createRegistration.feature @@ -1,77 +1,308 @@ Feature: CAMARA WebRTC Registration, vwip - Operation createRegistration - Background: Common createRegistration setup + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type: the API accepts 3-legged access tokens, identifying a single phone number, and 2-legged access tokens, which do not identify a single phone number. + # Unless a scenario states otherwise, the Background access token is a 3-legged access token and the request body does not include "$.phoneNumber". + # Scenarios using a 2-legged access token include "$.phoneNumber" in the request body unless stated otherwise. + # * Operator allowed minimum and maximum for "registrationExpireTime". + # * Per user, per MSISDN and per user device registration limits. + # + # Testing assets: + # * A 3-legged access token identifying a phone number enabled for the service. + # * A 2-legged access token and at least two phone numbers the API client is allowed to register. + # * A valid phone number the API client is not allowed to register with a 2-legged access token. + # * Users and phone numbers that have reached each registration limit, if the limits are enforced by the implementation. + # + # References to OAS spec schemas refer to schemas specified in webrtc-registration.yaml + + Background: Common "createRegistration" setup Given an environment at "apiRoot" - And the resource "/webrtc-registration/vwip/sessions" | + And the resource "/webrtc-registration/vwip/sessions" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the request body is set by default to a request body compliant with the schema at "/components/schemas/RegSessionRequest" - # Properties not explicitly overwritten in the Scenarios can take any values compliant with the schema + And the request body is set by default to a request body compliant with the schema at "#/components/schemas/RegSessionRequest" + +############################ Happy Path Scenarios ############################################# + + @webrtc_registration_createRegistration_01_3legged_token_without_phone_number + Scenario: Successful registration with a 3-legged access token and no phoneNumber in the request body + Given the header "Authorization" is set to a valid access token identifying a phone number + And the request body property "$.deviceId" is set to a valid UUID not used in any active registration + And the request body property "$.phoneNumber" is not included + When the request "createRegistration" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.regInfo.regStatus" is "Registered" + And the response property "$.expiresAt" is present + And the response property "$.regInfo.phoneNumber" is the phone number identified by the access token + And a subsequent request "getRegistrationById" with the path parameter "registrationId" set to the value of the response property "$.registrationId" responds with status code 200 and the same response body + + @webrtc_registration_createRegistration_02_2legged_token_with_phone_number + Scenario: Successful registration with a 2-legged access token and phoneNumber in the request body + Given the header "Authorization" is set to a valid access token which does not identify a single phone number + And the request body property "$.deviceId" is set to a valid UUID not used in any active registration + And the request body property "$.phoneNumber" is set to a phone number the API client is allowed to register + When the request "createRegistration" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.regInfo.regStatus" is "Registered" + And the response property "$.expiresAt" is present + And the response property "$.regInfo.phoneNumber" is equal to the request body property "$.phoneNumber" + And a subsequent request "getRegistrationById" with the path parameter "registrationId" set to the value of the response property "$.registrationId" responds with status code 200 and the same response body + + @webrtc_registration_createRegistration_03_expire_time_within_range + Scenario: Successful registration with registrationExpireTime within the operator allowed range + Given the request body property "$.registrationExpireTime" is set to a value within the operator allowed range + When the request "createRegistration" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.regInfo.regStatus" is "Registered" + And the response property "$.expiresAt" is present + And the response property "$.expiresAt" represents the same instant as the request body property "$.registrationExpireTime" - @webrtc_registration_createRegistration_01_generic_success_scenario - Scenario: Create a new registration session - When the client sends a POST request to "/sessions" with the following payload: - """ - { - "deviceId": "7d444840-9dc0-11d1-b245-5ffdce74fad2" - } - """ - Then the response status code should be 201 + @webrtc_registration_createRegistration_04_expire_time_above_maximum + Scenario: Successful registration with registrationExpireTime above the operator allowed maximum + Given the request body property "$.registrationExpireTime" is set to a value later than the operator allowed maximum + When the request "createRegistration" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body must contain a "registrationId" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.regInfo.regStatus" is "Registered" + And the response property "$.expiresAt" is present + And the response property "$.expiresAt" is earlier than the request body property "$.registrationExpireTime" - # Error scenarios + @webrtc_registration_createRegistration_05_same_device_different_phone_number + Scenario: Successful registration of an already registered deviceId bound to a different phone number + Given the header "Authorization" is set to a valid access token which does not identify a single phone number + And an existing registration created by operation "createRegistration" for a deviceId and a phone number + And the request body property "$.deviceId" is set to the deviceId of that registration + And the request body property "$.phoneNumber" is set to a different phone number the API client is allowed to register + When the request "createRegistration" is sent + Then the response status code is 201 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.regInfo.regStatus" is "Registered" + And the response property "$.expiresAt" is present + And the response property "$.regInfo.phoneNumber" is equal to the request body property "$.phoneNumber" + And the response property "$.registrationId" is different from the identifier of the existing registration - # Generic 400 errors +############################ Error Scenarios ################################################# - @webrtc_registration_createRegistration_400.1_no_request_body + @webrtc_registration_createRegistration_400.01_schema_not_compliant + Scenario: Invalid Argument. Generic Syntax Exception + Given the request body is included but is not compliant with the schema at "#/components/schemas/RegSessionRequest" + When the request "createRegistration" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_400.02_no_request_body Scenario: Missing request body Given the request body is not included - When the HTTP "POST" request is sent + When the request "createRegistration" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_registration_createRegistration_400.2_empty_request_body + @webrtc_registration_createRegistration_400.03_empty_request_body Scenario: Empty object as request body - Given the request body is set to "{}" - When the HTTP "POST" request is sent + Given the request body is set to {} + When the request "createRegistration" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_400.04_missing_required_property + Scenario Outline: Error response for missing required property in request body + Given the request body property "" is not included + When the request "createRegistration" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + Examples: + | required_property | + | $.deviceId | + + @webrtc_registration_createRegistration_C02.01_phone_number_not_schema_compliant + Scenario: Phone number value does not comply with the schema + Given the header "Authorization" is set to a valid access token which does not identify a single phone number + And the request body property "$.phoneNumber" does not comply with the OAS schema at "#/components/schemas/PhoneNumber" + When the request "createRegistration" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + @webrtc_registration_createRegistration_400.05_expire_time_below_minimum + Scenario: Out of range registrationExpireTime below the operator allowed minimum + Given the request body property "$.registrationExpireTime" is set to a value earlier than the operator allowed minimum + When the request "createRegistration" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "OUT_OF_RANGE" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_400.06_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "createRegistration" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text - @webrtc_registration_createRegistration_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the request body is set to a valid request body - When the HTTP "POST" request is sent + @webrtc_registration_createRegistration_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "createRegistration" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_createRegistration_401.2_expired_access_token - Scenario: Expired access token + @webrtc_registration_createRegistration_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the request body is set to a valid request body - When the HTTP "POST" request is sent + When the request "createRegistration" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_createRegistration_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_registration_createRegistration_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the request body is set to a valid request body - When the HTTP "POST" request is sent + When the request "createRegistration" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-registration:sessions:create" + When the request "createRegistration" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_403.02_phone_number_not_allowed + Scenario: Phone number not allowed for the API client with a 2-legged access token + Given the header "Authorization" is set to a valid access token which does not identify a single phone number + And the request body property "$.phoneNumber" is set to a valid phone number the API client is not allowed to register + When the request "createRegistration" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_403.03_max_registration_per_user + Scenario: Maximum number of registrations per user reached + Given the user owning the target phone number already has the maximum number of active registrations allowed per user + When the request "createRegistration" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "WEBRTC_REGISTRATION.MAX_REGISTRATION_PER_USER" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_403.04_max_registration_per_msisdn + Scenario: Maximum number of registrations per MSISDN reached + Given the target phone number already has the maximum number of active registrations allowed per MSISDN + When the request "createRegistration" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "WEBRTC_REGISTRATION.MAX_REGISTRATION_PER_MSISDN" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_403.05_max_devices_per_user + Scenario: Maximum number of devices per user reached + Given the user owning the target phone number already has the maximum number of registered devices allowed per user + And the request body property "$.deviceId" is set to a valid UUID not used in any registration of that user + When the request "createRegistration" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "WEBRTC_REGISTRATION.MAX_DEVICES_PER_USER" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_409.01_duplicated_registration + Scenario: Conflict due to an existing registration for the same deviceId and phoneNumber + Given an existing registration created by operation "createRegistration" for a deviceId and a phone number + And the request body property "$.deviceId" is set to the deviceId of that registration + And the request targets the phone number of that registration, identified by the access token or provided in the request body + When the request "createRegistration" is sent + Then the response status code is 409 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 409 + And the response property "$.code" is "ALREADY_EXISTS" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_C02.04_missing_phone_number + Scenario: Phone number not included and cannot be deduced from the access token + Given the header "Authorization" is set to a valid access token which does not identify a single phone number + And the request body property "$.phoneNumber" is not included + When the request "createRegistration" is sent + Then the response status code is 422 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 422 + And the response property "$.code" is "MISSING_IDENTIFIER" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_createRegistration_C02.03_unnecessary_phone_number + Scenario: Phone number not to be included when it can be deduced from the access token + Given the header "Authorization" is set to a valid access token identifying a phone number + And the request body property "$.phoneNumber" is set to a valid phone number + When the request "createRegistration" is sent + Then the response status code is 422 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 422 + And the response property "$.code" is "UNNECESSARY_IDENTIFIER" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-registration-deleteRegistrationById.feature b/code/Test_definitions/webrtc-registration-deleteRegistrationById.feature index b5c5a3c..d80572c 100644 --- a/code/Test_definitions/webrtc-registration-deleteRegistrationById.feature +++ b/code/Test_definitions/webrtc-registration-deleteRegistrationById.feature @@ -1,81 +1,119 @@ Feature: CAMARA WebRTC Registration, vwip - Operation deleteRegistrationById - Background: Common deleteRegistrationById setup + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type: the API accepts 3-legged access tokens, identifying a single phone number, and 2-legged access tokens, which do not identify a single phone number. The Background access token is any of them, granted access to the registration under test. + # + # Testing assets: + # * An existing registration created by operation "createRegistration" for each success scenario. + # + # References to OAS spec schemas refer to schemas specified in webrtc-registration.yaml + + Background: Common "deleteRegistrationById" setup Given an environment at "apiRoot" - And the resource "/webrtc-registration/vwip/sessions/{registrationId}" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-registration/vwip/sessions/{registrationId}" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "registrationId" is set by default to a existing register session + And the path parameter "registrationId" is set by default to the identifier of an existing registration + +############################ Happy Path Scenarios ############################################# @webrtc_registration_deleteRegistrationById_01_generic_success_scenario - Scenario: Delete an existing registration session - Given an existing registration session with "registrationId" as "existing-session-id" - When the client sends a DELETE request to "/sessions/existing-session-id" - Then the response status code should be 204 + Scenario: Delete an existing registration + Given an existing registration created by operation "createRegistration" + And the path parameter "registrationId" is set to the value of the identifier for that registration + When the request "deleteRegistrationById" is sent + Then the response status code is 204 And the response header "x-correlator" has same value as the request header "x-correlator" - And the registration session should no longer exist - - # Error scenarios - - @webrtc_registration_deleteRegistrationById_404_session_not_found - Scenario: Session identifier cannot be matched to a device - Given the path parameter "registrationId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "DELETE" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text + And a subsequent request "getRegistrationById" with the same path parameter "registrationId" responds with status code 404 - # Generic 400 errors +############################ Error Scenarios ################################################# - @webrtc_registration_deleteRegistrationById_400.1_no_request - Scenario: Missing request path - Given the path parameter "registrationId" is not included - When the HTTP "DELETE" request is sent + @webrtc_registration_deleteRegistrationById_400.01_registration_id_not_schema_compliant + Scenario: Path parameter "registrationId" not compliant with the schema + Given the path parameter "registrationId" is set to a value not compliant with the schema (longer than 256 characters) + When the request "deleteRegistrationById" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_registration_deleteRegistrationById_400.2_empty_request - Scenario: Empty object as request path - Given the path parameter "registrationId" is set to "" - When the HTTP "DELETE" request is sent + @webrtc_registration_deleteRegistrationById_400.02_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "deleteRegistrationById" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors - - @webrtc_registration_deleteRegistrationById_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "registrationId" is valid - When the HTTP "DELETE" request is sent + @webrtc_registration_deleteRegistrationById_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "deleteRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_deleteRegistrationById_401.2_expired_access_token - Scenario: Expired access token + @webrtc_registration_deleteRegistrationById_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "registrationId" is valid - When the HTTP "DELETE" request is sent + When the request "deleteRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_deleteRegistrationById_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_registration_deleteRegistrationById_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "registrationId" is valid - When the HTTP "DELETE" request is sent + When the request "deleteRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_registration_deleteRegistrationById_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-registration:sessions:delete" + When the request "deleteRegistrationById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_deleteRegistrationById_403.02_api_client_token_mismatch + Scenario: Registration not accessible with the given access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not have rights to access/manage the registration + And the path parameter "registrationId" is set to the identifier of an existing registration + When the request "deleteRegistrationById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_deleteRegistrationById_404.01_not_found + Scenario: Non-existing "registrationId" + Given the path parameter "registrationId" is set to a schema compliant value that does not identify any registration + When the request "deleteRegistrationById" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-registration-getRegistrationById.feature b/code/Test_definitions/webrtc-registration-getRegistrationById.feature index 11df2b7..f2be40a 100644 --- a/code/Test_definitions/webrtc-registration-getRegistrationById.feature +++ b/code/Test_definitions/webrtc-registration-getRegistrationById.feature @@ -1,83 +1,135 @@ Feature: CAMARA WebRTC Registration, vwip - Operation getRegistrationById - Background: Common getRegistrationById setup + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type: the API accepts 3-legged access tokens, identifying a single phone number, and 2-legged access tokens, which do not identify a single phone number. The Background access token is any of them, granted access to the registration under test. + # + # Testing assets: + # * An existing registration created by operation "createRegistration". + # * An expired registration, if it can be produced in the test environment. + # + # References to OAS spec schemas refer to schemas specified in webrtc-registration.yaml + + Background: Common "getRegistrationById" setup Given an environment at "apiRoot" - And the resource "/webrtc-registration/vwip/sessions/{registrationId}" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-registration/vwip/sessions/{registrationId}" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "registrationId" is set by default to a existing register session + And the path parameter "registrationId" is set by default to the identifier of an existing registration + +############################ Happy Path Scenarios ############################################# @webrtc_registration_getRegistrationById_01_generic_success_scenario - Scenario: Get the registration information - Given an existing registration session with "registrationId" as "a1b2c3d4-1234-5678-abcd-ef0123456789" - And the path parameter "registrationId" is set to the value for that register session - When the client sends a GET request to "/sessions/a1b2c3d4-1234-5678-abcd-ef0123456789" - Then the response status code should be 200 + Scenario: Retrieve an existing registration + Given an existing registration created by operation "createRegistration" + And the path parameter "registrationId" is set to the value of the identifier for that registration + When the request "getRegistrationById" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And the response body complies with the OAS schema at "/components/schemas/RegSessionResponse" - - # Error scenarios - - @webrtc_registration_getRegistrationById_404_session_not_found - Scenario: Registration identifier cannot be matched to an existing registration - Given the path parameter "registrationId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "GET" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.registrationId" is equal to the path parameter "registrationId" + And the response property "$.regInfo.phoneNumber" is equal to the phone number bound to that registration + And the response property "$.regInfo.regStatus" is "Registered" - # Generic 400 errors +############################ Error Scenarios ################################################# - @webrtc_registration_getRegistrationById_400.1_no_request - Scenario: Missing request path - Given the path parameter "registrationId" not included - When the HTTP "GET" request is sent + @webrtc_registration_getRegistrationById_400.01_registration_id_not_schema_compliant + Scenario: Path parameter "registrationId" not compliant with the schema + Given the path parameter "registrationId" is set to a value not compliant with the schema (longer than 256 characters) + When the request "getRegistrationById" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationById_400.2_empty_request - Scenario: Empty object as request path - Given the request body is set to "{}" - And the path parameter "registrationId" is set to "" - When the HTTP "GET" request is sent + @webrtc_registration_getRegistrationById_400.02_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "getRegistrationById" is sent Then the response status code is 400 And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors - - @webrtc_registration_getRegistrationById_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "registrationId" is valid - When the HTTP "GET" request is sent + @webrtc_registration_getRegistrationById_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "getRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationById_401.2_expired_access_token - Scenario: Expired access token + @webrtc_registration_getRegistrationById_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "registrationId" is valid - When the HTTP "GET" request is sent + When the request "getRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationById_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_registration_getRegistrationById_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "registrationId" is valid - When the HTTP "GET" request is sent + When the request "getRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text + + @webrtc_registration_getRegistrationById_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-registration:sessions:read" + When the request "getRegistrationById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_getRegistrationById_403.02_api_client_token_mismatch + Scenario: Registration not accessible with the given access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not have rights to access/manage the registration + And the path parameter "registrationId" is set to the identifier of an existing registration + When the request "getRegistrationById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_getRegistrationById_404.01_not_found + Scenario: Non-existing "registrationId" + Given the path parameter "registrationId" is set to a schema compliant value that does not identify any registration + When the request "getRegistrationById" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_getRegistrationById_404.02_expired_registration + Scenario: Expired registration + Given the path parameter "registrationId" is set to the identifier of an expired registration + When the request "getRegistrationById" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-registration-getRegistrationsByDeviceId.feature b/code/Test_definitions/webrtc-registration-getRegistrationsByDeviceId.feature index 932bf91..1b1819e 100644 --- a/code/Test_definitions/webrtc-registration-getRegistrationsByDeviceId.feature +++ b/code/Test_definitions/webrtc-registration-getRegistrationsByDeviceId.feature @@ -1,80 +1,132 @@ Feature: CAMARA WebRTC Registration, vwip - Operation getRegistrationsByDeviceId - Background: Common getRegistrationsByDeviceId setup + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type: the API accepts 3-legged access tokens, identifying a single phone number, and 2-legged access tokens, which do not identify a single phone number. The Background access token is any of them, authorizing the phone numbers of the registrations under test. + # + # Testing assets: + # * A deviceId with at least one active registration created by operation "createRegistration". + # * A deviceId with active registrations bound to phone numbers both authorized and not authorized by the access token. + # * A valid UUID not used as deviceId in any active registration. + # + # References to OAS spec schemas refer to schemas specified in webrtc-registration.yaml + + Background: Common "getRegistrationsByDeviceId" setup Given an environment at "apiRoot" - And the resource "/webrtc-registration/vwip/sessions" | - And the header "Content-Type" is set to "application/json" + And the resource "/webrtc-registration/vwip/sessions" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the query parameter "deviceId" is set by default to a existing device identifier + And the query parameter "deviceId" is set by default to the deviceId of an existing registration + +############################ Happy Path Scenarios ############################################# @webrtc_registration_getRegistrationsByDeviceId_01_generic_success_scenario - Scenario: Retrieve active registrations for a device - Given an existing registration session with "deviceId" as "7d444840-9dc0-11d1-b245-5ffdce74fad2" - And the query parameter "deviceId" is set to that device identifier - When the client sends a GET request to "/sessions?deviceId=7d444840-9dc0-11d1-b245-5ffdce74fad2" - Then the response status code should be 200 + Scenario: Retrieve the registrations of a device + Given at least an existing registration created by operation "createRegistration" + And the query parameter "deviceId" is set to the deviceId of that registration + When the request "getRegistrationsByDeviceId" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" - And each item of the response array, if any, complies with the OAS schema at "/components/schemas/RegSessionResponse" + And the response body is an array whose items comply with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response body includes an item whose property "$.registrationId" is the identifier of that registration - @webrtc_registration_getRegistrationsByDeviceId_02_no_registrations_for_device - Scenario: Device has no active registrations - Given the query parameter "deviceId" identifies a device with no active registrations - When the HTTP "GET" request is sent - Then the response status code should be 200 - And the response body is an empty array + @webrtc_registration_getRegistrationsByDeviceId_02_empty_response + Scenario: No active registrations for the deviceId + Given the query parameter "deviceId" is set to a valid UUID not used as deviceId in any active registration + When the request "getRegistrationsByDeviceId" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body is an empty array "[]" - # Error scenarios + @webrtc_registration_getRegistrationsByDeviceId_03_registrations_of_other_phone_numbers_excluded + Scenario: Registrations bound to phone numbers not authorized by the access token are not returned + Given existing registrations created by operation "createRegistration" for the same deviceId and different phone numbers + And the access token authorizes only some of those phone numbers + And the query parameter "deviceId" is set to that deviceId + When the request "getRegistrationsByDeviceId" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body is an array whose items comply with the OAS schema at "#/components/schemas/RegSessionResponse" + And every item property "$.regInfo.phoneNumber" in the response body is a phone number authorized by the access token - # Generic 400 errors +############################ Error Scenarios ################################################# - @webrtc_registration_getRegistrationsByDeviceId_400.1_no_deviceId - Scenario: Missing deviceId query parameter + @webrtc_registration_getRegistrationsByDeviceId_400.01_missing_device_id + Scenario: Missing query parameter "deviceId" Given the query parameter "deviceId" is not included - When the HTTP "GET" request is sent + When the request "getRegistrationsByDeviceId" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationsByDeviceId_400.2_empty_deviceId - Scenario: Empty deviceId query parameter - Given the query parameter "deviceId" is set to "" - When the HTTP "GET" request is sent + @webrtc_registration_getRegistrationsByDeviceId_400.02_invalid_device_id + Scenario: Query parameter "deviceId" not in UUID format + Given the query parameter "deviceId" is set to a value not compliant with the uuid format + When the request "getRegistrationsByDeviceId" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + @webrtc_registration_getRegistrationsByDeviceId_400.03_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "getRegistrationsByDeviceId" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationsByDeviceId_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the query parameter "deviceId" is valid - When the HTTP "GET" request is sent + @webrtc_registration_getRegistrationsByDeviceId_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "getRegistrationsByDeviceId" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationsByDeviceId_401.2_expired_access_token - Scenario: Expired access token + @webrtc_registration_getRegistrationsByDeviceId_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the query parameter "deviceId" is valid - When the HTTP "GET" request is sent + When the request "getRegistrationsByDeviceId" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_getRegistrationsByDeviceId_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_registration_getRegistrationsByDeviceId_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the query parameter "deviceId" is valid - When the HTTP "GET" request is sent + When the request "getRegistrationsByDeviceId" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text + + @webrtc_registration_getRegistrationsByDeviceId_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-registration:sessions:read" + When the request "getRegistrationsByDeviceId" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text diff --git a/code/Test_definitions/webrtc-registration-updateRegistrationById.feature b/code/Test_definitions/webrtc-registration-updateRegistrationById.feature index 1c38086..29d17e1 100644 --- a/code/Test_definitions/webrtc-registration-updateRegistrationById.feature +++ b/code/Test_definitions/webrtc-registration-updateRegistrationById.feature @@ -1,83 +1,173 @@ Feature: CAMARA WebRTC Registration, vwip - Operation updateRegistrationById - Background: Common updateRegistrationById setup + # Input to be provided by the implementation to the tester + # + # Implementation indications: + # * apiRoot: API root of the server URL + # * Access token type: the API accepts 3-legged access tokens, identifying a single phone number, and 2-legged access tokens, which do not identify a single phone number. The Background access token is any of them, granted access to the registration under test. + # * Operator TTL policy and allowed minimum and maximum for "registrationExpireTime". + # + # Testing assets: + # * An existing registration created by operation "createRegistration" that has not expired. + # + # References to OAS spec schemas refer to schemas specified in webrtc-registration.yaml + + Background: Common "updateRegistrationById" setup Given an environment at "apiRoot" - And the resource "/webrtc-registration/vwip/sessions/{registrationId}" | + And the resource "/webrtc-registration/vwip/sessions/{registrationId}" And the header "Content-Type" is set to "application/json" And the header "Authorization" is set to a valid access token And the header "x-correlator" complies with the schema at "#/components/schemas/XCorrelator" - And the path parameter "registrationId" is set by default to a existing register session + And the request body is set by default to a request body compliant with the schema at "#/components/schemas/RegSessionUpdate" + And the path parameter "registrationId" is set by default to the identifier of an existing registration + +############################ Happy Path Scenarios ############################################# - @webrtc_registration_updateRegistrationById_01_generic_success_scenario - Scenario: Update an existing registration session - Given an existing registration session with "registrationId" as "existing-session-id" - And the path parameter "registrationId" is set to the value for that register session - When the client sends a PUT request to "/sessions/existing-session-id" + @webrtc_registration_updateRegistrationById_01_refresh_without_expire_time + Scenario: Refresh a registration without registrationExpireTime + Given the request body property "$.registrationExpireTime" is not included + When the request "updateRegistrationById" is sent Then the response status code is 200 + And the response header "Content-Type" is "application/json" And the response header "x-correlator" has same value as the request header "x-correlator" And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" - And the response property "$.expiresAt" exists + And the response property "$.registrationId" is equal to the path parameter "registrationId" + And the response property "$.expiresAt" is present + And the response property "$.expiresAt" is later than the time the request was sent + And a subsequent request "getRegistrationById" with the same path parameter "registrationId" responds with status code 200 and the response property "$.expiresAt" equal to the one in this response - # Error scenarios + @webrtc_registration_updateRegistrationById_02_refresh_with_expire_time_within_range + Scenario: Refresh a registration with registrationExpireTime within the operator allowed range + Given the request body property "$.registrationExpireTime" is set to a value within the operator allowed range + When the request "updateRegistrationById" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.registrationId" is equal to the path parameter "registrationId" + And the response property "$.expiresAt" is present + And the response property "$.expiresAt" represents the same instant as the request body property "$.registrationExpireTime" + And a subsequent request "getRegistrationById" with the same path parameter "registrationId" responds with status code 200 and the response property "$.expiresAt" equal to the one in this response - @webrtc_registration_updateRegistrationById_404_session_not_found - Scenario: Session identifier cannot be matched to an existing call - Given the path parameter "registrationId" is compliant with the parameter schema but does not identify a valid session - When the HTTP "PUT" request is sent - Then the response status code is 404 - And the response property "$.status" is 404 - And the response property "$.code" is "NOT_FOUND" - And the response property "$.message" contains a user friendly text + @webrtc_registration_updateRegistrationById_03_refresh_with_expire_time_above_maximum + Scenario: Refresh a registration with registrationExpireTime above the operator allowed maximum + Given the request body property "$.registrationExpireTime" is set to a value later than the operator allowed maximum + When the request "updateRegistrationById" is sent + Then the response status code is 200 + And the response header "Content-Type" is "application/json" + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response body complies with the OAS schema at "#/components/schemas/RegSessionResponse" + And the response property "$.registrationId" is equal to the path parameter "registrationId" + And the response property "$.expiresAt" is present + And the response property "$.expiresAt" is earlier than the request body property "$.registrationExpireTime" - # Generic 400 errors +############################ Error Scenarios ################################################# - @webrtc_registration_updateRegistrationById_400.1_no_request_body - Scenario: Missing request path - Given the path parameter "registrationId" is not included - When the HTTP "PUT" request is sent + @webrtc_registration_updateRegistrationById_400.01_schema_not_compliant + Scenario: Invalid Argument. Generic Syntax Exception + Given the request body is included but is not compliant with the schema at "#/components/schemas/RegSessionUpdate" + When the request "updateRegistrationById" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @webrtc_registration_updateRegistrationById_400.2_empty_request_body - Scenario: Empty object as request path - Given the path parameter "registrationId" set to "" - When the HTTP "PUT" request is sent + @webrtc_registration_updateRegistrationById_400.02_expire_time_below_minimum + Scenario: Out of range registrationExpireTime below the operator allowed minimum + Given the request body property "$.registrationExpireTime" is set to a value earlier than the operator allowed minimum + When the request "updateRegistrationById" is sent + Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 400 + And the response property "$.code" is "OUT_OF_RANGE" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_updateRegistrationById_400.03_registration_id_not_schema_compliant + Scenario: Path parameter "registrationId" not compliant with the schema + Given the path parameter "registrationId" is set to a value not compliant with the schema (longer than 256 characters) + When the request "updateRegistrationById" is sent Then the response status code is 400 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 400 And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - # Generic 401 errors + @webrtc_registration_updateRegistrationById_400.04_invalid_x-correlator + Scenario: Invalid x-correlator header + Given the header "x-correlator" does not comply with the schema at "#/components/schemas/XCorrelator" + When the request "updateRegistrationById" is sent + Then the response status code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text - @webrtc_registration_updateRegistrationById_401.1_no_authorization_header - Scenario: No Authorization header - Given the header "Authorization" is removed - And the path parameter "registrationId" is valid - When the HTTP "PUT" request is sent + @webrtc_registration_updateRegistrationById_401.01_no_authorization_header + Scenario: Error response for no header "Authorization" + Given the header "Authorization" is not sent + When the request "updateRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_updateRegistrationById_401.2_expired_access_token - Scenario: Expired access token + @webrtc_registration_updateRegistrationById_401.02_expired_access_token + Scenario: Error response for expired access token Given the header "Authorization" is set to an expired access token - And the path parameter "registrationId" is valid - When the HTTP "PUT" request is sent + When the request "updateRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - @webrtc_registration_updateRegistrationById_401.3_invalid_access_token - Scenario: Invalid access token + @webrtc_registration_updateRegistrationById_401.03_invalid_access_token + Scenario: Error response for invalid access token Given the header "Authorization" is set to an invalid access token - And the path parameter "registrationId" is valid - When the HTTP "PUT" request is sent + When the request "updateRegistrationById" is sent Then the response status code is 401 + And the response header "x-correlator" has same value as the request header "x-correlator" And the response header "Content-Type" is "application/json" And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" - And the response property "$.message" contains a user friendly text \ No newline at end of file + And the response property "$.message" contains a user friendly text + + @webrtc_registration_updateRegistrationById_403.01_missing_access_token_scope + Scenario: Missing access token scope + Given the header "Authorization" is set to an access token that does not include scope "webrtc-registration:sessions:write" + When the request "updateRegistrationById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_updateRegistrationById_403.02_api_client_token_mismatch + Scenario: Registration not accessible with the given access token + Given the header "Authorization" is set to a valid access token emitted to an API client which did not have rights to access/manage the registration + And the path parameter "registrationId" is set to the identifier of an existing registration + When the request "updateRegistrationById" is sent + Then the response status code is 403 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @webrtc_registration_updateRegistrationById_404.01_not_found + Scenario: Non-existing "registrationId" + Given the path parameter "registrationId" is set to a schema compliant value that does not identify any registration + When the request "updateRegistrationById" is sent + Then the response status code is 404 + And the response header "x-correlator" has same value as the request header "x-correlator" + And the response header "Content-Type" is "application/json" + And the response property "$.status" is 404 + And the response property "$.code" is "NOT_FOUND" + And the response property "$.message" contains a user friendly text