diff --git a/code/Test_definitions/connected-network-type-subscriptions.feature b/code/Test_definitions/connected-network-type-subscriptions.feature new file mode 100644 index 00000000..16fd8803 --- /dev/null +++ b/code/Test_definitions/connected-network-type-subscriptions.feature @@ -0,0 +1,289 @@ +@Connected_network_type_subscription +Feature: CAMARA Connected Network Type Subscriptions API, vwip - Operations on subscriptions + +# Input to be provided by the implementation to the tests +# References to OAS spec schemas refer to schemas specifies in connected-network-type-subscriptions.yaml, version vwip + + Background: Connected Network Type Subscriptions setup + Given the resource "{apiroot}/connected-network-type-subscriptions/vwip" as base-url + And the header "Authorization" is set to a valid access token + And the header "x-correlator" is set to a UUID value + +######### Happy Path Scenarios ################################# + + @connected_network_type_subscriptions_01_create_connected_network_type_subscription_sync + Scenario: Create connected network type subscription synchronously + Given that subscriptions are created synchronously + And a valid subscription request body + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response 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" + + @connected_network_type_subscriptions_02_create_connected_network_type_subscription_async + Scenario: Create connected network type subscription asynchronously + Given that subscriptions are created asynchronously + And a valid subscription request body + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response 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" + + @connected_network_type_subscriptions_03_operation_to_retrieve_list_of_subscriptions_when_no_records + Scenario: Get a list of subscriptions when no subscriptions available + Given a client without subscriptions created + When the request "retrieveConnectedNetworkTypeSubscriptionList" is sent + Then the response 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 + + @connected_network_type_subscriptions_04_operation_to_retrieve_list_of_subscriptions + Scenario: Get a list of subscriptions + Given a client with subscriptions created + When the request "retrieveConnectedNetworkTypeSubscriptionList" is sent + Then the response 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 has an array of items and each item complies with the OAS schema at "/components/schemas/Subscription" + + @connected_network_type_subscriptions_05_operation_to_retrieve_subscription_based_on_an_existing_subscription-id + Scenario: Get a subscription based on existing subscription-id. + Given the path parameter "subscriptionId" is set to the identifier of an existing subscription + When the request "retrieveConnectedNetworkTypeSubscription" is sent + Then the response 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" + + @connected_network_type_subscriptions_06_operation_to_delete_subscription_based_on_an_existing_subscription-id + Scenario: Delete a subscription based on existing subscription-id. + Given the path parameter "subscriptionId" is set to the identifier of an existing subscription + When the request "deleteConnectedNetworkTypeSubscription" is sent + Then the response code is 202 or 204 + And the response header "x-correlator" has same value as the request header "x-correlator" + And if the response property $.status is 204 then response body is not available + And if the response property $.status is 202 then response body complies with the OAS schema at "/components/schemas/SubscriptionAsync" + + @connected_network_type_subscriptions_07_receive_notification_when_network_type_changed + Scenario: Receive notification for network-type-changed event + Given that subscriptions are created synchronously + And a valid subscription request body + And the request body property "$.types" contains the element "network-type-changed" + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 201 + And if the device network type changed + Then event notification "network-type-changed" is received on callback-url + And sink credentials are received as expected + And notification body complies with the OAS schema at "#/components/schemas/EventNetworkTypeChange" + And type="org.camaraproject.connected-network-type-subscriptions.v0.network-type-changed" + + @connected_network_type_subscriptions_08_subscription_ends_on_expiry + Scenario: Receive notification for subscription-ends event on expiry + Given that subscriptions are created synchronously + And a valid subscription request body + And the request body property "$.subscriptionExpireTime" is set to a value in the near future + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 201 + Then the subscription is expired + Then event notification "subscription-ends" is received on callback-url + And notification body complies with the OAS schema at "#/components/schemas/EventSubscriptionEnds" + And type="org.camaraproject.connected-network-type-subscriptions.v0.subscription-ends" + And the response property "$.terminationReason" is "SUBSCRIPTION_EXPIRED" + + @connected_network_type_subscriptions_09_subscription_end_when_max_events + Scenario: Receive notification for subscription-ends event on max events reached + Given that subscriptions are created synchronously + And a valid subscription request body + And the request body property "$.types" contains the element "network-type-changed" + And the request body property "$.subscriptionMaxEvents" is set to 1 + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 201 + Then event notification "network-type-changed" is received on callback-url + Then event notification "subscription-ends" is received on callback-url + And notification body complies with the OAS schema at "##/components/schemas/EventSubscriptionEnds" + And type="org.camaraproject.connected-network-type-subscriptions.v0.subscription-ends" + And the response property "$.terminationReason" is "MAX_EVENTS_REACHED" + + @connected_network_type_subscriptions_10_subscription_delete_event_validation + Scenario: Receive notification for subscription-ends event on deletion + Given that subscriptions are created synchronously + And a valid subscription request body + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 201 + When the request "deleteSubscription" is sent + Then the response code is 202 or 204 + Then event notification "subscription-ends" is received on callback-url + And notification body complies with the OAS schema at "##/components/schemas/EventSubscriptionEnds" + And type="org.camaraproject.connected-network-type-subscriptions.v0.subscription-ends" + And the response property "$.terminationReason" is "SUBSCRIPTION_DELETED" + +############### Error response scenarios ########################### + + @connected_network_type_subscriptions_11_create_network_type_subscription_with_invalid_parameter + Scenario: Create subscription with invalid parameter + Given the request body is not compliant with the schema "/components/schemas/SubscriptionRequest" + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response 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 + + @connected_network_type_subscriptions_12_creation_of_subscription_with_expiry_time_in_past + Scenario: Expiry time in past + Given a valid subscription request body + And request body property "$.subscriptionexpiretime" in past + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response 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 + + @connected_network_type_subscriptions_13_invalid_eventType + Scenario: Subscription creation with invalid event type + Given a valid subscription request body + And the request body property "$.types" is set to invalid value + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response 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 + + @connected_network_type_subscriptions_14_invalid_protocol + Scenario: subscription creation with invalid protocol + Given a valid subscription request body + And the request property "$.protocol" is not set to "HTTP" + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 400 + 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 + + @connected_network_type_subscriptions_15_invalid_credential + Scenario: subscription creation with invalid credential type + Given a valid subscription request body + And the request property "$.credentialType" is not "ACCESSTOKEN" + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 400 + 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 + + @connected_network_type_subscriptions_16_invalid_access_token_type + Scenario: subscription creation with invalid access token type + Given a valid subscription request body + And the request property "$.accessTokenType" is not "bearer" + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 400 + And the response property "$.status" is 400 + And the response property "$.code" is "INVALID_TOKEN" or "INVALID_ARGUMENT" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_17_no_authorization_header_for_create_subscription + Scenario: subscription creation with invalid credentials + Given a valid subscription request body + And header "Authorization" token is set to invalid credentials + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response code is 401 + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_18_expired_access_token_for_create_subscription + Scenario: Expired access token for create subscription + Given a valid subscription request body and header "Authorization" is expired + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response status code is 401 + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_19_permission_denied + Scenario: subscription creation with inconsistent access token for requested events subscription + # To test this, a token does not have the required scope + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service + And header "Authorization" set to access token referring different scope + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_20_unnecessary_identifier + Scenario: subscription creation with both a 3-legged token and explicit device identifier + # This test applies whether the device associated with the access token matches the explicit device identifier or not + # For 3-legged access tokens, an explicit device identifier MUST NOT be provided + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service + And header "Authorization" set to access token also referring to a device (which may or may not be the same device) + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response property "$.status" is 422 + And the response property "$.code" is "UNNECESSARY_IDENTIFIER" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_21_inconsistent_access_token_for_requested_events_subscription + Scenario: subscription creation with invalid access token for requested events subscription + # To test this, a token contains an unsupported event type for this API + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service + And the request body property "$.types" contains the supported event type in this API + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response property "$.status" is 403 + And the response property "$.code" is "SUBSCRIPTION_MISMATCH" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_22_unknown_subscription_id + Scenario: Get subscription when subscription-id is unknown to the system + Given the path parameter property "$.subscriptionId" is unknown to the system + When the request "retrieveConnectedNetworkTypeSubscription" is sent + Then the response 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 + + @connected_network_type_subscriptions_23_delete_unknown_subscription_id + Scenario: Delete subscription with subscription-id unknown to the system + Given the path parameter "subscriptionId" is set to the value unknown to system + When the request "deleteConnectedNetworkTypeSubscription" is sent + Then the response 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 + + @connected_network_type_subscriptions_24_create_with_identifier_mismatch + Scenario: Create subscription with identifier mismatch + Given the request body includes inconsistent identifiers + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response status code is 422 + And the response property "$.status" is 422 + And the response property "$.code" is "IDENTIFIER_MISMATCH" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_25_create_with_service_not_applicable + Scenario: Create subscription for a device not supported by the service + Given the request body includes a device identifier not applicable for this service + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response status code is 422 + 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 + + @connected_network_type_subscriptions_26_create_with_unsupported_identifier + Scenario: Create subscription with an unsupported identifier + Given the request body includes an identifier type not supported by the implementation + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response status code is 422 + And the response property "$.status" is 422 + And the response property "$.code" is "UNSUPPORTED_IDENTIFIER" + And the response property "$.message" contains a user friendly text + + @connected_network_type_subscriptions_27_missing_identifier + Scenario: Create subscription and identifier is not included in the request and the device or phone number identification cannot be derived from the 3-legged access token + Given the request body and identifier is not included and missing in the access token + When the request "createConnectedNetworkTypeSubscription" is sent + Then the response status code is 422 + 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 \ No newline at end of file diff --git a/code/Test_definitions/connected-network-type.feature b/code/Test_definitions/connected-network-type.feature new file mode 100644 index 00000000..32fa9b75 --- /dev/null +++ b/code/Test_definitions/connected-network-type.feature @@ -0,0 +1,221 @@ +@Connected_network_type +Feature: CAMARA Connected Network Type API, vwip - Operations for retrieve network type + +# Input to be provided by the implementation to the tests +# References to OAS spec schemas refer to schemas specifies in connected-network-type.yaml, version vwip + + Background: Common Connected Network Type setup + Given the resource "{api-root}/connected-network-type/vwip/retrieve" set as base-url + 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" is set to a UUID value + +############# Happy Path Scenarios ################## + + @connected_network_type_01_generic_success_scenario + Scenario: Check the connected network type to which the user device is connected + Given a valid testing device supported by the service, identified by the token or provided in the request body + And the testing device is connected to a mobile network + And the request body is set to a valid request body + When the HTTP "POST" request is sent + Then the response 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/ConnectedNetworkTypeResponse" + And the response property "$.connectedNetworkType" is "2G" or "3G" or "4G" or "5G" + + @connected_network_type_02_retrieval_undetermined_network + Scenario: The connected network type of the user device can not be determined + Given a valid testing device supported by the service, identified by the token or provided in the request body + And the testing device is not connected to a mobile network (e.g. connected only to WiFi, or not connected to any network) + And the request body is set to a valid request body + When the HTTP "POST" request is sent + Then the response 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/ConnectedNetworkTypeResponse" + And the response property "$.connectedNetworkType" is "UNKNOWN" + +############# Error Response Scenarios ################## + + @connected_network_type_3_device_empty + Scenario: The device value is an empty object + Given the header "Authorization" is set to a valid access token which does not identify a single device + And the request body property "$.device" is set to: {} + When the HTTP "POST" request 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 + + @connected_network_type_4_device_identifiers_not_schema_compliant + Scenario Outline: Some device identifier value does not comply with the schema + Given the header "Authorization" is set to a valid access token which does not identify a single device + And the request body property "" does not comply with the OAS schema at "" + When the HTTP "POST" request 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 + + Examples: + | device_identifier | oas_spec_schema | + | $.device.phoneNumber | /components/schemas/PhoneNumber | + | $.device.ipv4Address | /components/schemas/NetworkAccessIdentifier | + | $.device.ipv6Address | /components/schemas/DeviceIpv4Addr | + | $.device.networkIdentifier | /components/schemas/DeviceIpv6Address | + + @connected_network_type_5_device_phoneNumber_schema_compliant + # Example of the scenario above with a higher level of specification + # TBD if test plan has to provide specific testing values to provoke an error + Scenario Outline: Device identifier phoneNumber value does not comply with the schema + Given the header "Authorization" is set to a valid access token which does not identify a single device + And the request body property "$.device.phoneNumber" is set to: + When the HTTP "POST" request 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 + + Examples: + | phone_number_value | + | string_value | + | 1234567890 | + | +12334foo22222 | + | +00012230304913849 | + | 123 | + | ++49565456787 | + + @connected_network_type_6_device_not_found + Scenario: Some identifier cannot be matched to a device + Given the request body property "$.device" is set to a value compliant to the OAS schema at "/components/schemas/Device" but does not identify a device managed by the API provider + And the header "Authorization" is set to a valid access token which does not identify a single device + When the HTTP "POST" request is sent + Then the response status code is 404 + And the response property "$.status" is 404 + And the response property "$.code" is "IDENTIFIER_NOT_FOUND" + And the response property "$.message" contains a user friendly text + + @connected_network_type_7_device_identifiers_unsupported + Scenario: None of the provided device identifiers is supported by the implementation + Given that some type of device identifiers are not supported by the implementation + And the header "Authorization" is set to a valid access token which does not identify a single device + And the request body property "$.device" only includes device identifiers not supported by the implementation + When the HTTP "POST" request is sent + Then the response status code is 422 + And the response property "$.status" is 422 + And the response property "$.code" is "UNSUPPORTED_IDENTIFIERS" + And the response property "$.message" contains a user friendly text + + @connected_network_type_8_device_identifiers_mismatch + Scenario: Device identifiers mismatch + # To test this, at least 2 types of identifiers have to be provided, e.g. a phoneNumber and the IP address of a device associated to a different phoneNumber + Given that the implementation supports multiple device identifiers + And the header "Authorization" is set to a valid access token which does not identify a single device + And the request body property "$.device" includes several identifiers, each of them identifying a valid but different device + When the HTTP "POST" request is sent + Then the response status code is 422 + And the response property "$.status" is 422 + And the response property "$.code" is "IDENTIFIER_MISMATCH" + And the response property "$.message" contains a user friendly text + + @connected_network_type_9_unnecessary_device + Scenario: Device not to be included when it can be deduced from the access token + # This test applies whether the device associated with the access token matches the explicit device identifier or not + # For 3-legged access tokens, an explicit device identifier MUST NOT be provided + Given the header "Authorization" is set to a valid access token identifying a device + And the request body property "$.device" is set to a valid device (which may or may not be the same device) + When the HTTP "POST" request is sent + Then the response status code is 422 + 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 + + @connected_network_type_10_device_not_supported + Scenario: Service not available for the device + Given that the service is not available for all devices commercialized by the operator + And a valid device, identified by the token or provided in the request body, for which the service is not applicable + When the HTTP "POST" request is sent + Then the response status code is 422 + 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 + + @connected_network_type_11_device_missing_identifier + Scenario: Cannot be identified from the access token and the optional device object + Given the request body property "$.device" is optional and not set + And the header "Authorization" is set to a valid access token without a device identifier + When the HTTP "POST" request is sent + Then the response status code is 422 + 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 + + # Generic 400 errors + + @connected_network_type_12_no_request_body + Scenario: Missing request body + Given the request body is not included + When the HTTP "POST" request 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 + + # Other specific 400 errors + + @connected_network_type_13_max_age_schema_compliant + Scenario: Input property values doe not comply with the schema + Given a valid testing device supported by the service, identified by the token or provided in the request body + And the "maxAge" is set to 6a0 + When the HTTP "POST" request 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 + + @connected_network_type_14_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 + Then the response status code is 401 + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + @connected_network_type_15_expired_access_token + Scenario: 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 + Then the response status code is 401 + And the response property "$.status" is 401 + And the response property "$.code" is "UNAUTHENTICATED" + And the response property "$.message" contains a user friendly text + + @connected_network_type_16_invalid_access_token + Scenario: 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 + Then the response status code is 401 + 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 + + # Generic 403 error + + @connected_network_type_17_permissions_denied + Scenario: Client does not have sufficient permissions to perform this action + 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 + Then the response status code is 403 + 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 \ No newline at end of file diff --git a/code/Test_definitions/device-reachability-status-subscriptions.feature b/code/Test_definitions/device-reachability-status-subscriptions.feature index f27ee48d..77af3133 100644 --- a/code/Test_definitions/device-reachability-status-subscriptions.feature +++ b/code/Test_definitions/device-reachability-status-subscriptions.feature @@ -1,74 +1,74 @@ @DeviceReachabilityStatusSubscription -Feature: Device Reachability Status Subscriptions API, v0.6.0 - Operations Reachability Status Subscription +Feature: Device Reachability Status Subscriptions API, vwip - Operations Reachability Status Subscription # Input to be provided by the implementation to the tests -# References to OAS spec schemas refer to schemas specified in device-reachability-status-subscriptions.yaml, version v0.6.0 +# References to OAS spec schemas refer to schemas specified in device-reachability-status-subscriptions.yaml, version vwip Background: Common Device Reachability Status Subscriptions setup - Given the resource "{apiroot}/device-reachability-status-subscriptions/v0.6" as base-url + Given the resource "{apiroot}/device-reachability-status-subscriptions/vwip" as base-url And the header "Authorization" is set to a valid access token And the header "x-correlator" is set to a UUID value ######### Happy Path Scenarios ################################# -@reachability_status_subscriptions_01_create_reachability_status_subscription_synchronously - Scenario: Create reachability status subscription synchronously + @reachability_status_subscriptions_01_create_reachability_status_subscription_synchronously + Scenario: Create reachability status subscription synchronously Given that subscriptions are created synchronously And a valid subscription request body - When the request "createDeviceReachabilityStatusSubscription" is sent + When the request "createDeviceReachabilityStatusSubscription" is sent Then the response 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" -@reachability_status_subscriptions_02_create_reachability_status_subscription_asynchronously - Scenario: Create reachability status subscription asynchronously + @reachability_status_subscriptions_02_create_reachability_status_subscription_asynchronously + Scenario: Create reachability status subscription asynchronously Given that subscriptions are created asynchronously And a valid subscription request body - When the request "createDeviceReachabilityStatusSubscription" is sent + When the request "createDeviceReachabilityStatusSubscription" is sent Then the response 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" -@reachability_status_subscriptions_03_Operation_to_retrieve_list_of_subscriptions_when_no_records + @reachability_status_subscriptions_03_operation_to_retrieve_list_of_subscriptions_when_no_records Scenario: Get a list of subscriptions when no subscriptions available Given a client without subscriptions created - When the request "retrieveSubscriptionList" is sent + When the request "retrieveDeviceReachabilityStatusSubscriptionList" is sent Then the response 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 -@reachability_status_subscriptions_04_Operation_to_retrieve_list_of_subscriptions - Scenario: Get a list of subscriptions + @reachability_status_subscriptions_04_operation_to_retrieve_list_of_subscriptions + Scenario: Get a list of subscriptions Given a client with subscriptions created - When the request "retrieveSubscriptionList" is sent + When the request "retrieveDeviceReachabilityStatusSubscriptionList" is sent Then the response 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 has an array of items and each item complies with the OAS schema at "/components/schemas/Subscription" - @reachability_status_subscriptions_05_Operation_to_retrieve_subscription_based_on_an_existing_subscription-id + @reachability_status_subscriptions_05_operation_to_retrieve_subscription_based_on_an_existing_subscription-id Scenario: Get a subscription based on existing subscription-id. Given the path parameter "subscriptionId" is set to the identifier of an existing subscription - When the request "retrieveSubscription" is sent + When the request "retrieveDeviceReachabilityStatusSubscription" is sent Then the response 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" - @reachability_status_subscriptions_06_Operation_to_delete_subscription_based_on_an_existing_subscription-id + @reachability_status_subscriptions_06_operation_to_delete_subscription_based_on_an_existing_subscription-id Scenario: Delete a subscription based on existing subscription-id. Given the path parameter "subscriptionId" is set to the identifier of an existing subscription - When the request "deleteSubscription" is sent + When the request "deleteDeviceReachabilityStatusSubscription" is sent Then the response code is 202 or 204 And the response header "x-correlator" has same value as the request header "x-correlator" And if the response property $.status is 204 then response body is not available And if the response property $.status is 202 then response body complies with the OAS schema at "/components/schemas/SubscriptionAsync" -@reachability_status_subscriptions_07_Receive_notification_when_device_reachability_changed_to_data_usage + @reachability_status_subscriptions_07_receive_notification_when_device_reachability_changed_to_data_usage Scenario: Receive notification for reachability-data event Given that subscriptions are created synchronously And a valid subscription request body @@ -81,10 +81,10 @@ Feature: Device Reachability Status Subscriptions API, v0.6.0 - Operations Reach And notification body complies with the OAS schema at "##/components/schemas/EventReachabilityData" And type="org.camaraproject.device-reachability-status-subscriptions.v0.reachability-data" -@reachability_status_subscriptions_08_Receive_notification_when_device_reachability_changed_to_sms_usage + @reachability_status_subscriptions_08_receive_notification_when_device_reachability_changed_to_sms_usage Scenario: Receive notification for reachability-sms event Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "reachability-sms" When the request "createDeviceReachabilityStatusSubscription" is sent Then the response code is 201 @@ -94,10 +94,10 @@ Feature: Device Reachability Status Subscriptions API, v0.6.0 - Operations Reach And notification body complies with the OAS schema at "##/components/schemas/EventReachabilitySms" And type="org.camaraproject.device-reachability-status-subscriptions.v0.reachability-sms" -@reachability_status_subscriptions_09_Receive_notification_when_device_reachability_changed_to_disconnected + @reachability_status_subscriptions_09_receive_notification_when_device_reachability_changed_to_disconnected Scenario: Receive notification for reachability-disconnected event Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "reachability-disconnected" When the request "createDeviceReachabilityStatusSubscription" is sent Then the response code is 201 @@ -107,8 +107,8 @@ Feature: Device Reachability Status Subscriptions API, v0.6.0 - Operations Reach And notification body complies with the OAS schema at "##/components/schemas/EventReachabilityDisconnected" And type="org.camaraproject.device-reachability-status-subscriptions.v0.reachability-disconnected" -@reachability_status_subscriptions_10_subscription_expiry -Scenario: Receive notification for subscription-ends event on expiry + @reachability_status_subscriptions_10_subscription_expiry + Scenario: Receive notification for subscription-ends event on expiry Given that subscriptions are created synchronously And a valid subscription request body And the request body property "$.subscriptionExpireTime" is set to a value in the near future @@ -120,10 +120,10 @@ Scenario: Receive notification for subscription-ends event on expiry And type="org.camaraproject.device-reachability-status-subscriptions.v0.subscription-ends" And the response property "$.terminationReason" is "SUBSCRIPTION_EXPIRED" -@reachability_status_subscriptions_11_subscription_end_when_max_events - Scenario: Receive notification for subscription-ends event on max events reached + @reachability_status_subscriptions_11_subscription_end_when_max_events + Scenario: Receive notification for subscription-ends event on max events reached Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "reachability-data" And the request body property "$.subscriptionMaxEvents" is set to 1 When the request "createDeviceReachabilityStatusSubscription" is sent @@ -135,9 +135,9 @@ Scenario: Receive notification for subscription-ends event on expiry And the response property "$.terminationReason" is "MAX_EVENTS_REACHED" @reachability_status_subscriptions_12_subscription_delete_event_validation - Scenario: Receive notification for subscription-ends event on deletion + Scenario: Receive notification for subscription-ends event on deletion Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body When the request "createDeviceReachabilityStatusSubscription" is sent Then the response code is 201 When the request "deleteSubscription" is sent @@ -147,39 +147,38 @@ Scenario: Receive notification for subscription-ends event on expiry And type="org.camaraproject.device-reachability-status-subscriptions.v0.subscription-ends" And the response property "$.terminationReason" is "SUBSCRIPTION_DELETED" - ############### Error response scenarios ########################### - @reachability_status_subscriptions_13_Create_reachability_status_subscription_with_invalid_parameter - Scenario: Create subscription with invalid parameter + @reachability_status_subscriptions_13_create_reachability_status_subscription_with_invalid_parameter + Scenario: Create subscription with invalid parameter Given the request body is not compliant with the schema "/components/schemas/SubscriptionRequest" - When the request "createDeviceReachabilityStatusSubscription" is sent + When the request "createDeviceReachabilityStatusSubscription" is sent Then the response 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 -@reachability_status_subscriptions_14_creation_of_subscription_with_expiry_time_in_past + @reachability_status_subscriptions_14_creation_of_subscription_with_expiry_time_in_past Scenario: Expiry time in past Given a valid subscription request body And request body property "$.subscriptionexpiretime" in past - When the request "createDeviceReachabilityStatusSubscription" is sent + When the request "createDeviceReachabilityStatusSubscription" is sent Then the response 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 - @reachability_status_subscription_15_invalid_protocol - Scenario: subscription creation with invalid protocol + @reachability_status_subscription_15_invalid_protocol + Scenario: subscription creation with invalid protocol Given a valid subscription request body - And the request property "$.protocol" is not set to "HTTP" + And the request property "$.protocol" is not set to "HTTP" When the request "createDeviceReachabilityStatusSubscription" is sent Then the response property "$.status" is 400 And the response property "$.code" is "INVALID_PROTOCOL" And the response property "$.message" contains a user friendly text -@reachability_status_subscription_16_invalid_credential_type - Scenario: subscription creation with invalid credential type + @reachability_status_subscription_16_invalid_credential_type + Scenario: subscription creation with invalid credential type Given a valid subscription request body And the request property "$.credentialType" is not "ACCESSTOKEN" When the request "createDeviceReachabilityStatusSubscription" is sent @@ -187,8 +186,8 @@ Scenario: Receive notification for subscription-ends event on expiry And the response property "$.code" is "INVALID_CREDENTIAL" And the response property "$.message" contains a user friendly text -@reachability_status_subscription_17_invalid_access_token_type - Scenario: subscription creation with invalid access token type + @reachability_status_subscription_17_invalid_access_token_type + Scenario: subscription creation with invalid access token type Given a valid subscription request body And the request property "$.accessTokenType" is not "bearer" When the request "createDeviceReachabilityStatusSubscription" is sent @@ -196,8 +195,8 @@ Scenario: Receive notification for subscription-ends event on expiry And the response property "$.code" is "INVALID_TOKEN" or "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text -@reachability_status_subscription_18_invalid_credentials - Scenario: subscription creation with invalid credentials + @reachability_status_subscription_18_invalid_credentials + Scenario: subscription creation with invalid credentials Given a valid subscription request body And header "Authorization" token is set to invalid credentials When the request "createDeviceReachabilityStatusSubscription" is sent @@ -205,21 +204,43 @@ Scenario: Receive notification for subscription-ends event on expiry And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text -@reachability_status_subscription_19_invalid_inconsistent_access_token - Scenario: subscription creation with inconsistent access token for requested events subscription - # To test this, a token have to be obtained for a different device + @reachability_status_subscription_19_permission_denied + Scenario: subscription creation with inconsistent access token for requested events subscription + # To test this, a token does not have the required scope Given a valid subscription request body And the request body property "$.device" is set to a valid testing device supported by the service + And header "Authorization" set to access token referring different scope + When the request "createDeviceReachabilityStatusSubscription" is sent + Then the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @reachability_status_subscription_20_invalid_token_context + Scenario: subscription creation with invalid access token context for requested events subscription + # To test this, a token does not have the required device identifier + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service And header "Authorization" set to access token referring different device When the request "createDeviceReachabilityStatusSubscription" is sent Then the response property "$.status" is 403 + And the response property "$.code" is "INVALID_TOKEN_CONTEXT" + And the response property "$.message" contains a user friendly text + + @reachability_status_subscription_21_inconsistent_access_token_for_requested_events_subscription + Scenario: subscription creation with invalid access token for requested events subscription + # To test this, a token contains an unsupported event type for this API + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service + And the request body property "$.types" contains the supported event type in this API + When the request "createDeviceReachabilityStatusSubscription" is sent + Then the response property "$.status" is 403 And the response property "$.code" is "SUBSCRIPTION_MISMATCH" And the response property "$.message" contains a user friendly text -@reachability_status_subscription_20_unknown_subscription_id - Scenario: Get subscription when subscription-id is unknown to the system + @reachability_status_subscription_22_unknown_subscription_id + Scenario: Get subscription when subscription-id is unknown to the system Given the path parameter property "$.subscriptionId" is unknown to the system - When the request "retrieveSubscription" is sent + When the request "retrieveDeviceReachabilityStatusSubscription" is sent Then 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/device-reachability-status.feature b/code/Test_definitions/device-reachability-status.feature index 2cb639f7..d5b638e4 100644 --- a/code/Test_definitions/device-reachability-status.feature +++ b/code/Test_definitions/device-reachability-status.feature @@ -1,12 +1,12 @@ @Device_reachability_status -Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachability status +Feature: CAMARA Device reachability status API, vwip - Operations for reachability status # Input to be provided by the implementation to the tests -# References to OAS spec schemas refer to schemas specifies in device-reachability-status.yaml, version v0.6.0 +# References to OAS spec schemas refer to schemas specifies in device-reachability-status.yaml, version vwip Background: Common Device reachability status setup - Given the resource "{api-root}/device-reachability-status/v0.6/retrieve" set as base-url | + Given the resource "{api-root}/device-reachability-status/vwip/retrieve" set as base-url 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" is set to a UUID value @@ -26,8 +26,8 @@ Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachabi And the response property "$.connectivity" includes "SMS" @device_reachability_status_02_reachableAndConnectedData - Scenario: Check the reachability status if device is connected with DATA - Given a valid device reachability status request body + Scenario: Check the reachability status if device is connected with DATA + Given a valid device reachability status request body And the request body property "$.device" is set to a valid testing device which is connected with data and supported by the service When the request "getReachabilityStatus" is sent Then the response code is 200 @@ -104,7 +104,7 @@ Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachabi And the response property "$.message" contains a user friendly text @device_reachability_status_09_deviceStatus_inconsistent_access_token - Scenario: Inconsistent access token context for the device + Scenario: Inconsistent access token context for the device # To test this, a token has to be obtained for a different device Given a valid device reachability status request body And the request body property "$.device" is set to a valid testing device supported by the service @@ -116,7 +116,7 @@ Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachabi And the response property "$.message" contains a user friendly text @device_reachability_status_10_deviceStatusWithIdentifiersMismatch - Scenario: Device reachabilityidentifiers mismatch + Scenario: Device reachabilityidentifiers mismatch # To test this, at least 2 types of identifiers have to be provided, e.g. a phoneNumber and the IP address of a Device reachability associated to a different phoneNumber Given a valid device reachability status request body And the request body property "$.device" includes several identifiers, each of them identifying a valid but different device @@ -126,8 +126,8 @@ Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachabi And the response property "$.code" is "DEVICE_IDENTIFIERS_MISMATCH" And the response property "$.message" contains a user friendly text - @device_reachability_status_11_deviceStatus_NotApplicable - Scenario: Device reachability not applicable + @device_reachability_status_11_deviceStatus_NotApplicable + Scenario: Device reachability not applicable Given a valid device reachability status request body And the request body property "$.device" refers to an unknown device When the request "getReachabilityStatus" is sent @@ -136,8 +136,8 @@ Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachabi And the response property "$.code" is "DEVICE_NOT_APPLICABLE" And the response property "$.message" contains a user friendly text - @device_reachability_status_12_unable_to_provide_reachability_status - Scenario: Unable to provide reachability status for a device + @device_reachability_status_12_unable_to_provide_reachability_status + Scenario: Unable to provide reachability status for a device Given a valid device reachability status request body And the request body property "$.device" refers to a device having network issue When the request "getReachabilityStatus" is sent @@ -146,8 +146,8 @@ Feature: CAMARA Device reachability status API, v0.6.0 - Operations for reachabi And the response property "$.code" is "UNABLE_TO_PROVIDE_REACHABILITY_STATUS" And the response property "$.message" contains a user friendly text - @device_reachability_status_13_unsupported_device_identifiers - Scenario: Unsupported device identifiers + @device_reachability_status_13_unsupported_device_identifiers + Scenario: Unsupported device identifiers Given a valid device reachability status request body And the request body property "$.device" set to unsupported identifiers value for the service When the request "getReachabilityStatus" is sent diff --git a/code/Test_definitions/device-roaming-status-subscriptions.feature b/code/Test_definitions/device-roaming-status-subscriptions.feature index c3c7f882..42763a69 100644 --- a/code/Test_definitions/device-roaming-status-subscriptions.feature +++ b/code/Test_definitions/device-roaming-status-subscriptions.feature @@ -1,74 +1,74 @@ @DeviceStatusRoamingSubscription -Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingStatus +Feature: Device Roaming Status Subscriptions API, vwip - Operations RoamingStatus # Input to be provided by the implementation to the tests -# References to OAS spec schemas refer to schemas specified in device-roaming-status-subscriptions.yaml, version v0.6.0 +# References to OAS spec schemas refer to schemas specified in device-roaming-status-subscriptions.yaml, version vwip Background: Common Device Roaming Status setup - Given the resource "{apiroot}/device-roaming-status-subscriptions/v0.6" as base-url + Given the resource "{apiroot}/device-roaming-status-subscriptions/vwip" as base-url And the header "Authorization" is set to a valid access token And the header "x-correlator" is set to a UUID value ######### Happy Path Scenarios ################################# -@roaming_status_subscriptions_01_create_roaming_status_subscription_synchronously - Scenario: Create roaming status subscription synchronously + @roaming_status_subscriptions_01_create_roaming_status_subscription_synchronously + Scenario: Create roaming status subscription synchronously Given that subscriptions are created synchronously And a valid subscription request body - When the request "createDeviceRoamingStatusSubscription" is sent + When the request "createDeviceRoamingStatusSubscription" is sent Then the response 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" -@roaming_status_subscriptions_02_create_roaming_status_subscription_asynchronously - Scenario: Create roaming status subscription asynchronously + @roaming_status_subscriptions_02_create_roaming_status_subscription_asynchronously + Scenario: Create roaming status subscription asynchronously Given that subscriptions are created asynchronously And a valid subscription request body - When the request "createDeviceRoamingStatusSubscription" is sent + When the request "createDeviceRoamingStatusSubscription" is sent Then the response 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" -@roaming_status_subscriptions_03_Operation_to_retrieve_list_of_subscriptions_when_no_records + @roaming_status_subscriptions_03_Operation_to_retrieve_list_of_subscriptions_when_no_records Scenario: Get a list of subscriptions when no subscriptions Given a client without subscriptions created - When the request "retrieveSubscriptionList" is sent + When the request "retrieveDeviceRoamingStatusSubscriptionList" is sent Then the response 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 -@roaming_status_subscriptions_04_Operation_to_retrieve_list_of_subscriptions + @roaming_status_subscriptions_04_Operation_to_retrieve_list_of_subscriptions Scenario: Get a list of subscriptions. Given a client with subscriptions created - When the request "retrieveSubscriptionList" is sent + When the request "retrieveDeviceRoamingStatusSubscriptionList" is sent Then the response 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 has an array of items and each item complies with the OAS schema at "/components/schemas/Subscription" - @roaming_status_subscriptions_05_Operation_to_retrieve_subscription_based_on_an_existing_subscription-id + @roaming_status_subscriptions_05_Operation_to_retrieve_subscription_based_on_an_existing_subscription-id Scenario: Get a subscription based on existing subscription-id. Given the path parameter "subscriptionId" is set to the identifier of an existing subscription - When the request "retrieveSubscription" is sent + When the request "retrieveDeviceRoamingStatusSubscription" is sent Then the response 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" - @roaming_status_subscriptions_06_Operation_to_delete_subscription_based_on_an_existing_subscription-id + @roaming_status_subscriptions_06_Operation_to_delete_subscription_based_on_an_existing_subscription-id Scenario: Delete a subscription based on existing subscription-id. Given the path parameter "subscriptionId" is set to the identifier of an existing subscription - When the request "deleteSubscription" is sent + When the request "deleteDeviceRoamingStatusSubscription" is sent Then the response code is 202 or 204 And the response header "x-correlator" has same value as the request header "x-correlator" And if the response property $.status is 204 then response body is not available And if the response property $.status is 202 then response body complies with the OAS schema at "/components/schemas/SubscriptionAsync" -@roaming_status_subscriptions_07_Receive_notification_when_roaming_status_changed_to_on + @roaming_status_subscriptions_07_Receive_notification_when_roaming_status_changed_to_on Scenario: Receive notification for roaming-on event Given that subscriptions are created synchronously And a valid subscription request body @@ -81,10 +81,10 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And notification body complies with the OAS schema at "##/components/schemas/EventRoamingOn" And type="org.camaraproject.roaming-status-subscriptions.v0.roaming-on" -@roaming_status_subscriptions_08_Receive_notification_when_roaming_status_changed_to_off + @roaming_status_subscriptions_08_Receive_notification_when_roaming_status_changed_to_off Scenario: Receive notification for roaming-off event Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "roaming-off" When the request "createDeviceRoamingStatusSubscription" is sent Then the response code is 201 @@ -94,10 +94,10 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And notification body complies with the OAS schema at "##/components/schemas/EventRoamingOff" And type="org.camaraproject.roaming-status-subscriptions.v0.roaming-off" -@roaming_status_subscriptions_09_Receive_notification_when_roaming_status_changed + @roaming_status_subscriptions_09_Receive_notification_when_roaming_status_changed Scenario: Receive notification for roaming-status changes Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "roaming-status" When the request "createDeviceRoamingStatusSubscription" is sent Then the response code is 201 @@ -107,10 +107,10 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And notification body complies with the OAS schema at "##/components/schemas/EventRoamingStatus" And type="org.camaraproject.roaming-status-subscriptions.v0.roaming-status" -@roaming_status_subscriptions_10_Receive_notification_when_roaming_change_country + @roaming_status_subscriptions_10_Receive_notification_when_roaming_change_country Scenario: Receive notification for roaming-change-country Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "roaming-change-country" When the request "createDeviceRoamingStatusSubscription" is sent Then the response code is 201 @@ -120,8 +120,8 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And notification body complies with the OAS schema at "##/components/schemas/RoamingChangeCountry" And type="org.camaraproject.roaming-status-subscriptions.v0.roaming-change-country" -@roaming_status_subscriptions_11_subscription_expiry - Scenario: Receive notification for subscription-ends event on expiry + @roaming_status_subscriptions_11_subscription_expiry + Scenario: Receive notification for subscription-ends event on expiry Given that subscriptions are created synchronously And a valid subscription request body And the request body property "$.subscriptionExpireTime" is set to a value in the near future @@ -133,10 +133,10 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And type="org.camaraproject.roaming-status-subscriptions.v0.subscription-ends" And the response property "$.terminationReason" is "SUBSCRIPTION_EXPIRED" -@roaming_status_subscriptions_12_subscription_ends_when_max_events_reached - Scenario: Receive notification for subscription-ends event on max events reached + @roaming_status_subscriptions_12_subscription_ends_when_max_events_reached + Scenario: Receive notification for subscription-ends event on max events reached Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body And the request body property "$.type" is "roaming_on" And the request body property "$.subscriptionMaxEvents" is set to 1 When the request "createDeviceRoamingStatusSubscription" is sent @@ -148,9 +148,9 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And the response property "$.terminationReason" is "MAX_EVENTS_REACHED" @roaming_status_subscriptions_13_subscription_delete_event_validation - Scenario: Receive notification for subscription-ends event on deletion + Scenario: Receive notification for subscription-ends event on deletion Given that subscriptions are created synchronously - And a valid subscription request body + And a valid subscription request body When the request "createDeviceRoamingStatusSubscription" is sent Then the response code is 201 When the request "deleteSubscription" is sent @@ -160,30 +160,29 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And type="org.camaraproject.roaming-status-subscriptions.v0.subscription-ends" And the response property "$.terminationReason" is "SUBSCRIPTION_DELETED" - ############### Error response scenarios ########################### @roaming_status_subscriptions_14_Create_roaming_status_subscription_with_invalid_parameter - Scenario: Create subscription with invalid parameter + Scenario: Create subscription with invalid parameter Given the request body is not compliant with the schema "/components/schemas/SubscriptionRequest" - When the request "createDeviceRoamingStatusSubscription" is sent + When the request "createDeviceRoamingStatusSubscription" is sent Then the response 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 -@roaming_status_subscriptions_15_creation_of_subscription_with_expiry_time_in_past + @roaming_status_subscriptions_15_creation_of_subscription_with_expiry_time_in_past Scenario: Expiry time in past Given a valid subscription request body And request body property "$.subscriptionExpireTime" in past - When the request "createDeviceRoamingStatusSubscription" is sent + When the request "createDeviceRoamingStatusSubscription" is sent Then the response 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 - @roaming_status_subscription_16_invalid_protocol - Scenario: subscription creation with invalid protocol + @roaming_status_subscription_16_invalid_protocol + Scenario: subscription creation with invalid protocol Given a valid subscription request body And the request property "$.protocol" is not "HTTP" When the request "createDeviceRoamingStatusSubscription" is sent @@ -191,8 +190,8 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And the response property "$.code" is "INVALID_PROTOCOL" And the response property "$.message" contains a user friendly text -@roaming_status_subscription_17_invalid_credential_type - Scenario: subscription creation with invalid credential type + @roaming_status_subscription_17_invalid_credential_type + Scenario: subscription creation with invalid credential type Given a valid subscription request body And the request property "$.credentialType" is not "ACCESSTOKEN" When the request "createDeviceRoamingStatusSubscription" is sent @@ -200,8 +199,8 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And the response property "$.code" is "INVALID_CREDENTIAL" And the response property "$.message" contains a user friendly text -@roaming_status_subscription_18_invalid_access_token_type - Scenario: subscription creation with invalid access token type + @roaming_status_subscription_18_invalid_access_token_type + Scenario: subscription creation with invalid access token type Given a valid subscription request body And the request property "$.accessTokenType" is not "bearer" When the request "createDeviceRoamingStatusSubscription" is sent @@ -209,8 +208,8 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And the response property "$.code" is "INVALID_TOKEN" or "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text -@roaming_status_subscription_19_invalid_credentials - Scenario: subscription creation with invalid credentials + @roaming_status_subscription_19_invalid_credentials + Scenario: subscription creation with invalid credentials Given a valid subscription request body And header "Authorization" token is set to invalid credentials When the request "createDeviceRoamingStatusSubscription" is sent @@ -218,21 +217,44 @@ Feature: Device Roaming Status Subscriptions API, v0.6.0 - Operations RoamingSta And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text -@roaming_status_subscription_20_invalid_inconsistent_access_token - Scenario: subscription creation with inconsistent access token for requested events subscription - # To test this, a token have to be obtained for a different device - Given a valid subscription request body + @roaming_status_subscription_20_permission_denied + Scenario: subscription creation with inconsistent access token for requested events subscription + # To test this, a token does not have the required scope + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service + And header "Authorization" set to access token referring different scope + When the request "createDeviceRoamingStatusSubscription" is sent + Then the response property "$.status" is 403 + And the response property "$.code" is "PERMISSION_DENIED" + And the response property "$.message" contains a user friendly text + + @roaming_status_subscription_21_unnecessary_identifier + Scenario: subscription creation with both a 3-legged token and explicit device identifier + # This test applies whether the device associated with the access token matches the explicit device identifier or not + # For 3-legged access tokens, an explicit device identifier MUST NOT be provided + Given a valid subscription request body + And the request body property "$.device" is set to a valid testing device supported by the service + And header "Authorization" set to access token also referring to a device (which may or may not be the same device) + When the request "createDeviceRoamingStatusSubscription" is sent + Then the response property "$.status" is 422 + And the response property "$.code" is "UNNECESSARY_IDENTIFIER" + And the response property "$.message" contains a user friendly text + + @roaming_status_subscription_22_inconsistent_access_token_for_requested_events_subscription + Scenario: subscription creation with invalid access token for requested events subscription + # To test this, a token contains an unsupported event type for this API + Given a valid subscription request body And the request body property "$.device" is set to a valid testing device supported by the service - And header "Authorization" set to access token referring different device + And the request body property "$.types" contains the supported event type in this API When the request "createDeviceRoamingStatusSubscription" is sent Then the response property "$.status" is 403 And the response property "$.code" is "SUBSCRIPTION_MISMATCH" And the response property "$.message" contains a user friendly text -@roaming_status_subscription_21_unknown_subscription_id - Scenario: Get subscription when subscription-id is unknown to the system + @roaming_status_subscription_23_unknown_subscription_id + Scenario: Get subscription when subscription-id is unknown to the system Given the path parameter property "$.subscriptionId" is unknown to the system - When the request "retrieveSubscription" is sent + When the request "retrieveDeviceRoamingStatusSubscription" is sent Then 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/device-roaming-status.feature b/code/Test_definitions/device-roaming-status.feature index 99aa8cb8..7dad1c7a 100644 --- a/code/Test_definitions/device-roaming-status.feature +++ b/code/Test_definitions/device-roaming-status.feature @@ -1,12 +1,12 @@ @Device_Roaming_Status -Feature: CAMARA Device Roaming Status API, v0.6.0 - Operations for Roaming Status +Feature: CAMARA Device Roaming Status API, vwip - Operations for Roaming Status # Input to be provided by the implementation to the tests -# References to OAS spec schemas refer to schemas specifies in device-roaming-status.yaml, version v0.6.0 +# References to OAS spec schemas refer to schemas specifies in device-roaming-status.yaml, version vwip Background: Common Device Roaming status setup - Given the resource "{api-root}/device-roaming-status/v0.6/retrieve" set as base-url | + Given the resource "{api-root}/device-roaming-status/vwip/retrieve" set as base-url 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" is set to a UUID value @@ -17,7 +17,7 @@ Feature: CAMARA Device Roaming Status API, v0.6.0 - Operations for Roaming Statu Scenario: Check the roaming status when device is in the roaming mode Given a valid devicestatus request body And the request body property "$.device" is set to a valid testing device which is in roaming and supported by the service - When the request "getRoamingStatus" is sent + When the request "getRoamingStatus" is sent Then the response 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" @@ -51,50 +51,50 @@ Feature: CAMARA Device Roaming Status API, v0.6.0 - Operations for Roaming Statu And the response property "$.code" is "INVALID_ARGUMENT" And the response property "$.message" contains a user friendly text - @device_roaming_status_04_expired_access_token - Scenario: Expired access token - Given a valid devicestatus request body - And header "Authorization" is set to expired token - When the request "getRoamingStatus" is sent + @device_roaming_status_04_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 "getRoamingStatus" request is sent Then the response status code is 401 And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - - @device_roaming_status_05_no_authorization_header - Scenario: No Authorization header - Given a valid devicestatus request body - And header "Authorization" is not available - When the request "getRoamingStatus" is sent + + @device_roaming_status_05_expired_access_token + Scenario: 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 "getRoamingStatus" request is sent Then the response status code is 401 And the response property "$.status" is 401 And the response property "$.code" is "UNAUTHENTICATED" And the response property "$.message" contains a user friendly text - + @device_roaming_status_06_invalid_access_token - Scenario: Invalid access token - Given a valid devicestatus request body - And header "Authorization" set to an invalid access token + Scenario: 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 "getRoamingStatus" request is sent Then the response status code is 401 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 - @device_roaming_status_07_deviceStatus_inconsistent_access_token - Scenario: Inconsistent access token context for the device + @device_roaming_status_07_permissions_denied + Scenario: Client does not have sufficient permissions to perform this action # To test this, a token has to be obtained for a different device - Given a valid devicestatus request body - And the request body property "$.device" is set to a valid testing device supported by the service - And header "Authorization" set to access token referring different device + Given the header "Authorization" is set to an invalid access token + And the request body is set to a valid request body When the request "getRoamingStatus" is sent Then the response status code is 403 And the response property "$.status" is 403 - And the response property "$.code" is "INVALID_TOKEN_CONTEXT" + And the response property "$.code" is "PERMISSION_DENIED" And the response property "$.message" contains a user friendly text @device_roaming_status_08_deviceStatusWithIdentifiersMismatch - Scenario: Device identifiers mismatch + Scenario: Device identifiers mismatch # To test this, at least 2 types of identifiers have to be provided, e.g. a phoneNumber and the IP address of a device associated to a different phoneNumber Given a valid devicestatus request body And the request body property "$.device" includes several identifiers, each of them identifying a valid but different device @@ -104,32 +104,34 @@ Feature: CAMARA Device Roaming Status API, v0.6.0 - Operations for Roaming Statu And the response property "$.code" is "DEVICE_IDENTIFIERS_MISMATCH" And the response property "$.message" contains a user friendly text - @device_roaming_status_09_deviceStatus_not_applicable - Scenario: Device roaming not applicable - Given a valid devicestatus request body - And the request body property "$.device" refers to an unknown device + @device_roaming_status_09_device_not_supported + Scenario: Service not available for the device + Given that the service is not available for all devices commercialized by the operator + And a valid device, identified by the token or provided in the request body, for which the service is not applicable When the request "getRoamingStatus" is sent Then the response status code is 422 And the response property "$.status" is 422 - And the response property "$.code" is "DEVICE_NOT_APPLICABLE" + And the response property "$.code" is "SERVICE_NOT_APPLICABLE" And the response property "$.message" contains a user friendly text - @device_roaming_status_10_deviceStatus_unable_to_provide_reachability_status - Scenario: Unable to provide roaming status for a device - Given a valid devicestatus request body - And the request body property "$.device" refers to a device having network issue + @device_roaming_status_10_unnecessary_device + Scenario: Device not to be included when it can be deduced from the access token + # This test applies whether the device associated with the access token matches the explicit device identifier or not + # For 3-legged access tokens, an explicit device identifier MUST NOT be provided + Given the header "Authorization" is set to a valid access token identifying a device + And the request body property "$.device" is set to a valid device (which may or may not be the same device) When the request "getRoamingStatus" is sent Then the response status code is 422 And the response property "$.status" is 422 - And the response property "$.code" is "UNABLE_TO_PROVIDE_ROAMING_STATUS" + And the response property "$.code" is "UNNECESSARY_IDENTIFIER" And the response property "$.message" contains a user friendly text - @device_roaming_status_11_deviceStatus_unsupported_device_identifiers - Scenario: Unsupported device identifiers - Given a valid devicestatus request body - And the request body property "$.device" set to unsupported identifiers value for the service + @device_roaming_status_11_unable_to_provide_roaming_status + Scenario: Unable to provide roaming status for a device + Given a valid devicestatus request body + And the request body property "$.device" refers to a device having network issue When the request "getRoamingStatus" is sent - Then the response status code is 422 - And the response property "$.status" is 422 - And the response property "$.code" is "UNSUPPORTED_DEVICE_IDENTIFIERS" + Then the response status code is 503 + And the response property "$.status" is 503 + And the response property "$.code" is "UNAVAILABLE" And the response property "$.message" contains a user friendly text