Commit 1b50ac5d authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Improved test title for capif_api_publish_service 15 and 16

parent 95254e85
Loading
Loading
Loading
Loading
Loading
+26 −23
Original line number Original line Diff line number Diff line
@@ -398,6 +398,7 @@ Check Two Published APIs with different APFs are removed when Provider is delete
Publish API same apiName but different AEF
Publish API same apiName but different AEF
    [Tags]    capif_api_publish_service-15  smoke
    [Tags]    capif_api_publish_service-15  smoke


    # Set API name
    ${api_name}=  Set Variable    testing_robot_service_1
    ${api_name}=  Set Variable    testing_robot_service_1


    # Default Invoker Registration and Onboarding
    # Default Invoker Registration and Onboarding
@@ -408,7 +409,6 @@ Publish API same apiName but different AEF
    ${aef_id_1}=    Set Variable    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']}
    ${aef_id_1}=    Set Variable    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']}
    ${aef_id_2}=    Set Variable
    ${aef_id_2}=    Set Variable
    ...    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']}
    ...    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']}
    ${aef_ids}=    Create List    ${aef_id_1}    ${aef_id_2}


    ## Publish API service_1 with aefIds_1
    ## Publish API service_1 with aefIds_1
    ${service_api_description_published_1_1}    ${resource_url}    ${request_body}=    Publish Service Api
    ${service_api_description_published_1_1}    ${resource_url}    ${request_body}=    Publish Service Api
@@ -416,7 +416,7 @@ Publish API same apiName but different AEF
    ...    ${api_name}
    ...    ${api_name}
    ...    aef_id=${aef_id_1}
    ...    aef_id=${aef_id_1}


    ## Publish API service_2 with aefIds_2
    ## Publish API service_1 with aefIds_2
    ${service_api_description_published_1_2}    ${resource_url}    ${request_body}=    Publish Service Api
    ${service_api_description_published_1_2}    ${resource_url}    ${request_body}=    Publish Service Api
    ...    ${register_user_info_provider_1}
    ...    ${register_user_info_provider_1}
    ...    ${api_name}
    ...    ${api_name}
@@ -427,68 +427,71 @@ Publish API same apiName but different AEF
    ${aef2_id_1}=    Set Variable
    ${aef2_id_1}=    Set Variable
    ...    ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']}
    ...    ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']}


    ## Publish API service_2 with Provider2
    ## Publish API service_1 with Provider2
    ${service_api_description_published_2}    ${resource_url_2}    ${request_body_2}=    Publish Service Api
    ${service_api_description_published_2}    ${resource_url_2}    ${request_body_2}=    Publish Service Api
    ...    ${register_user_info_provider_2}
    ...    ${register_user_info_provider_2}
    ...    ${api_name}
    ...    ${api_name}
    ...    aef_id=${aef2_id_1}
    ...    aef_id=${aef2_id_1}


    # Check if there are 2 API published with same apiName but different AEFs
    # Validation of final scenario.
    # Retrieve Services published
    ## Check if there are 2 API published with same apiName but different AEFs by retrieving all APIs for provider 1 using APF provider credentials
    ### Retrieve Services published
    ${resp}=    Get Request Capif
    ${resp}=    Get Request Capif
    ...    /published-apis/v1/${register_user_info_provider_1['apf_id']}/service-apis
    ...    /published-apis/v1/${register_user_info_provider_1['apf_id']}/service-apis
    ...    server=${CAPIF_HTTPS_URL}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    verify=ca.crt
    ...    username=${APF_PROVIDER_USERNAME}
    ...    username=${APF_PROVIDER_USERNAME}


    ### Validate response and values obtained
    Check Response Variable Type And Values    ${resp}    200    ServiceAPIDescription
    Check Response Variable Type And Values    ${resp}    200    ServiceAPIDescription

    #### Check returned values
    List Should Contain Value    ${resp.json()}    ${service_api_description_published_1_1}
    List Should Contain Value    ${resp.json()}    ${service_api_description_published_1_1}
    List Should Contain Value    ${resp.json()}    ${service_api_description_published_1_2}
    List Should Contain Value    ${resp.json()}    ${service_api_description_published_1_2}


    # Check if there are 3 API published with same apiName but different AEFs
    ## Check if there are 3 API published with same apiName but different AEFs
    # Discover API published
    ### Discover API published by retrieving all APIs for Invoker using Invoker credentials
    # Request all APIs for Invoker
    ${resp}=    Get Request Capif
    ${resp}=    Get Request Capif
    ...    ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name}
    ...    ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name}
    ...    server=${CAPIF_HTTPS_URL}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}
    ...    username=${INVOKER_USERNAME}


    ### Validate response and values obtained
    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs
    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs

    #### Check returned values
    # Check returned values
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    3
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    3
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_1_1}
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_1_1}
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_1_2}
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_1_2}
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_2}
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_2}



Publish API same apiName and same AEF


Publish API same apiName but different AEF
    [Tags]    capif_api_publish_service-16  smoke
    [Tags]    capif_api_publish_service-16  smoke


    # Set API name
    ${api_name}=  Set Variable    testing_robot_service_1
    ${api_name}=  Set Variable    testing_robot_service_1


    # Default Invoker Registration and Onboarding
    # Default Invoker Registration and Onboarding
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding


    # Create Provider1 with 2 AEF roles and publish API
    # Create Provider1 with 2 AEF roles
    ${register_user_info_provider_1}=    Provider Default Registration    total_aef_roles=2
    ${register_user_info_provider_1}=    Provider Default Registration    total_aef_roles=2
    ${aef_id_1}=    Set Variable    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']}
    ${aef_id_1}=    Set Variable    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}']['aef_id']}
    ${aef_id_2}=    Set Variable    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']}
    ${aef_id_2}=    Set Variable    ${register_user_info_provider_1['aef_roles']['${AEF_PROVIDER_USERNAME}_1']['aef_id']}
    ${aef_ids}=    Create List    ${aef_id_1}    ${aef_id_2}
    ${aef_ids}=    Create List    ${aef_id_1}    ${aef_id_2}



    ## Publish API service_1 with aefIds_1
    ${resp}   ${request_body}=    Publish Service Api Request   ${register_user_info_provider_1}    ${api_name}    aef_id=${aef_id_1}
    ${resp}   ${request_body}=    Publish Service Api Request   ${register_user_info_provider_1}    ${api_name}    aef_id=${aef_id_1}


    ### Validate response and values obtained
    Check Response Variable Type And Values    ${resp}    201    ServiceAPIDescription
    Check Response Variable Type And Values    ${resp}    201    ServiceAPIDescription
    Dictionary Should Contain Key    ${resp.json()}    apiId
    Dictionary Should Contain Key    ${resp.json()}    apiId
    ${service_api_description_published_1_1}=   Set Variable    ${resp.json()}
    ${service_api_description_published_1_1}=   Set Variable    ${resp.json()}


    ## Publish API service_1 with aefIds_1, error expected since same apiName and same AEF
    ${resp}   ${request_body}=    Publish Service Api Request   ${register_user_info_provider_1}    ${api_name}    aef_id=${aef_id_1}
    ${resp}   ${request_body}=    Publish Service Api Request   ${register_user_info_provider_1}    ${api_name}    aef_id=${aef_id_1}

    ### Validate error response and values obtained
    Check Response Variable Type And Values    ${resp}    403    ProblemDetails
    Check Response Variable Type And Values    ${resp}    403    ProblemDetails
    ...    status=403
    ...    status=403
    ...    title=Forbidden
    ...    title=Forbidden
@@ -500,24 +503,24 @@ Publish API same apiName but different AEF
    ${aef2_id_1}=    Set Variable
    ${aef2_id_1}=    Set Variable
    ...    ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']}
    ...    ${register_user_info_provider_2['aef_roles']['${AEF_PROVIDER_USERNAME}_NEW']['aef_id']}


    ## Publish API service_2 with Provider2
    ## Publish API service_1 with Provider2 aefid_1, since same apiName but different AEF, it should be published successfully
    ${service_api_description_published_2}    ${resource_url_2}    ${request_body_2}=    Publish Service Api
    ${service_api_description_published_2}    ${resource_url_2}    ${request_body_2}=    Publish Service Api
    ...    ${register_user_info_provider_2}
    ...    ${register_user_info_provider_2}
    ...    ${api_name}
    ...    ${api_name}
    ...    aef_id=${aef2_id_1}
    ...    aef_id=${aef2_id_1}


    # Check if there are 2 API published with same apiName but different AEFs
    # Validation of final scenario.
    # Discover API published
    ## Check if there are 2 API published with same apiName but different AEFs
    # Request all APIs for Invoker
    ### Discover API published by retrieving all APIs for Invoker using Invoker credentials
    ${resp}=    Get Request Capif
    ${resp}=    Get Request Capif
    ...    ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name}
    ...    ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}&api_name=${api_name}
    ...    server=${CAPIF_HTTPS_URL}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}
    ...    username=${INVOKER_USERNAME}


    ### Validate response and values obtained
    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs
    Check Response Variable Type And Values    ${resp}    200    DiscoveredAPIs

    #### Check returned values
    # Check returned values
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Should Not Be Empty    ${resp.json()['serviceAPIDescriptions']}
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    2
    Length Should Be    ${resp.json()['serviceAPIDescriptions']}    2
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_1_1}
    List Should Contain Value    ${resp.json()['serviceAPIDescriptions']}    ${service_api_description_published_1_1}