Loading tests/features/Helper/Visibility Control Api/visibility_control.robot +66 −6 Original line number Diff line number Diff line Loading @@ -397,26 +397,86 @@ Discover Published service APIs by Unauthorised API Invoker Visibility Control Length Should Be ${resp.json()['rules']} 0 # ========== Discover Published service APIs by Unauthorised API Invoker Visibility Control (several Apps APIs) Discover Published service APIs by Unauthorised API Invoker Visibility Control (two APIs) [Tags] visibility_control-102 # Register APF ${register_user_info}= Provider Default Registration # Publish API 1 ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api # Publish two APIs from the same provider ${service_api_description_allowed} ${resource_url_allowed} ${request_body}= Publish Service Api ... ${register_user_info} ... service_1 ${service_api_description_denied} ${resource_url_denied} ${request_body}= Publish Service Api ... ${register_user_info} ... service_2 # --- Check Published APIs by APF --- # Check Published APIs by APF ${resp}= Get Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${register_user_info['apf_username']} # Check Results Status Should Be 200 ${resp} Should Not Be Empty ${resp.json()} Length Should Be ${resp.json()} 1 Length Should Be ${resp.json()} 2 # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding ${invoker_id}= Set Variable ${register_user_info_invoker['api_invoker_id']} # Before rules, both APIs are discoverable ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions Length Should Be ${resp.json()['serviceAPIDescriptions']} 2 # Restrict visibility so that only the selected API remains visible. # With an ALLOW rule for the allowed API, any non-matching API is denied by default. ${aef_list}= Create List ${register_user_info['aef_id']} ${apiId_list}= Create List ${service_api_description_allowed['apiId']} ${apiName_list}= Create List ${service_api_description_allowed['apiName']} ${provider_selector}= Create Dictionary aefId=${aef_list} apiId=${apiId_list} apiName=${apiName_list} userName=${register_user_info['apf_username']} ${body}= Create Visibility Control Rule Body 3 ${EMPTY} ${provider_selector} ${resp}= Post Request Capif ... /helper/visibility-control/rules ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${SUPERADMIN_USERNAME} ... json=${body} Status Should Be 201 ${resp} ${rule_id}= Set Variable ${resp.json()['ruleId']} # Only the selected API should remain visible for this invoker ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions Length Should Be ${resp.json()['serviceAPIDescriptions']} 1 List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_allowed} List Should Not Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_denied} ${resp}= Delete Request Capif ... /helper/visibility-control/rules/${rule_id} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${SUPERADMIN_USERNAME} Status Should Be 204 ${resp} # ========== Discover Published service APIs by Unauthorised API Invoker Visibility Control (having several rules) Loading Loading
tests/features/Helper/Visibility Control Api/visibility_control.robot +66 −6 Original line number Diff line number Diff line Loading @@ -397,26 +397,86 @@ Discover Published service APIs by Unauthorised API Invoker Visibility Control Length Should Be ${resp.json()['rules']} 0 # ========== Discover Published service APIs by Unauthorised API Invoker Visibility Control (several Apps APIs) Discover Published service APIs by Unauthorised API Invoker Visibility Control (two APIs) [Tags] visibility_control-102 # Register APF ${register_user_info}= Provider Default Registration # Publish API 1 ${service_api_description_published} ${resource_url} ${request_body}= Publish Service Api # Publish two APIs from the same provider ${service_api_description_allowed} ${resource_url_allowed} ${request_body}= Publish Service Api ... ${register_user_info} ... service_1 ${service_api_description_denied} ${resource_url_denied} ${request_body}= Publish Service Api ... ${register_user_info} ... service_2 # --- Check Published APIs by APF --- # Check Published APIs by APF ${resp}= Get Request Capif ... /published-apis/v1/${register_user_info['apf_id']}/service-apis ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${register_user_info['apf_username']} # Check Results Status Should Be 200 ${resp} Should Not Be Empty ${resp.json()} Length Should Be ${resp.json()} 1 Length Should Be ${resp.json()} 2 # Default Invoker Registration and Onboarding ${register_user_info_invoker} ${url} ${request_body}= Invoker Default Onboarding ${invoker_id}= Set Variable ${register_user_info_invoker['api_invoker_id']} # Before rules, both APIs are discoverable ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions Length Should Be ${resp.json()['serviceAPIDescriptions']} 2 # Restrict visibility so that only the selected API remains visible. # With an ALLOW rule for the allowed API, any non-matching API is denied by default. ${aef_list}= Create List ${register_user_info['aef_id']} ${apiId_list}= Create List ${service_api_description_allowed['apiId']} ${apiName_list}= Create List ${service_api_description_allowed['apiName']} ${provider_selector}= Create Dictionary aefId=${aef_list} apiId=${apiId_list} apiName=${apiName_list} userName=${register_user_info['apf_username']} ${body}= Create Visibility Control Rule Body 3 ${EMPTY} ${provider_selector} ${resp}= Post Request Capif ... /helper/visibility-control/rules ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${SUPERADMIN_USERNAME} ... json=${body} Status Should Be 201 ${resp} ${rule_id}= Set Variable ${resp.json()['ruleId']} # Only the selected API should remain visible for this invoker ${resp}= Get Request Capif ... ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&aef-id=${register_user_info['aef_id']} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${INVOKER_USERNAME} Check Response Variable Type And Values ${resp} 200 DiscoveredAPIs Dictionary Should Contain Key ${resp.json()} serviceAPIDescriptions Length Should Be ${resp.json()['serviceAPIDescriptions']} 1 List Should Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_allowed} List Should Not Contain Value ${resp.json()['serviceAPIDescriptions']} ${service_api_description_denied} ${resp}= Delete Request Capif ... /helper/visibility-control/rules/${rule_id} ... server=${CAPIF_HTTPS_URL} ... verify=ca.crt ... username=${SUPERADMIN_USERNAME} Status Should Be 204 ${resp} # ========== Discover Published service APIs by Unauthorised API Invoker Visibility Control (having several rules) Loading