Test Plan for CAPIF Open Discover Service API
At this documentation you will have all information and related files and examples of test plan for this API.
Test Case 1: Open Discover Published service APIs by Authorised Entity
Test ID: capif_api_open_discover_service-1
Description:
This test case will check if any JWT-authenticated entity can open discover published service APIs.
Pre-Conditions:
- Service APIs are published.
- Provider was registered previously.
Execution Steps:
- Register Provider at CCF, store certificates and Publish Service API at CCF.
- Open Discover Service APIs using JWT token.
Information of Test:
- Perform Provider Registration
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_1
- Use APF Certificate
- Request Open Discover Published APIs:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis
- No query parameters required
- Use JWT Bearer Token
Expected Result:
-
Response to Publish request must accomplish:
- 201 Created
- Response Body must follow ServiceAPIDescription data structure with:
- apiId
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}
-
Response to Open Discover Request:
- 200 OK response.
- Response body must follow OpenDiscoveryResp data structure:
- Check if
discApiscontains the API published previously.
- Check if
Test Case 2: Open Discover Published service APIs by Non Authorised Entity
Test ID: capif_api_open_discover_service-2
Description:
This test case will check that a request without a valid JWT token is rejected with 401 Unauthorized.
Pre-Conditions:
- Service APIs are published.
Execution Steps:
- Register Provider at CCF, store certificates and Publish Service API at CCF.
- Request Open Discover without JWT token.
Information of Test:
- Perform Provider Registration
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_1
- Use APF Certificate
- Request Open Discover Published APIs without authorization:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis
- No
Authorizationheader
Expected Result:
-
Response to Publish request must accomplish:
- 201 Created
- Response Body must follow ServiceAPIDescription data structure with:
- apiId
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}
-
Response to Open Discover Request:
- 401 Unauthorized
- Error Response Body must accomplish with ProblemDetails data structure with:
- status 401
- title with message "Unauthorized"
- detail with message "User not authorized".
- cause with message "Certificate not authorized".
Test Case 3: Open Discover Published service APIs when no APIs are published
Test ID: capif_api_open_discover_service-3
Description:
This test case will check that the Open Discover endpoint returns 404 when no service APIs are registered at the CCF.
Pre-Conditions:
- No Service APIs are published at the CCF.
Execution Steps:
- Register Provider at CCF, store certificates. Do not publish any API.
- Request Open Discover using JWT token.
Information of Test:
- Perform Provider Registration
- Request Open Discover without any published APIs:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis
- Use JWT Bearer Token
Expected Result:
- Response to Open Discover Request:
- 404 Not Found response.
- Error Response Body must accomplish with ProblemDetails data structure with:
- status 404
- title with message "Not Found"
- detail with message "No API Published accomplish filter conditions".
- cause with message "No API Published accomplish filter conditions".
Test Case 4: Open Discover Published service APIs filtered by api-names with 1 result
Test ID: capif_api_open_discover_service-4
Description:
This test case will check if an authenticated entity can filter open discovered service APIs by API name and obtain only the matching result.
Pre-Conditions:
- At least 2 Service APIs are published.
Execution Steps:
- Register Provider at CCF, store certificates and Publish Service APIs service_1 and service_2 at CCF.
- Open Discover all Service APIs.
- Open Discover filtered by api-names service_1.
Information of Test:
- Perform Provider Registration
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_1
- Use APF Certificate
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_2
- Use APF Certificate
- Request Open Discover Published APIs:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis
- Use JWT Bearer Token
- Request Open Discover filtering by api-names:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis?api-names=service_1
- Use JWT Bearer Token
Expected Result:
- Response to each Publish request must accomplish:
- 201 Created
- Response Body must follow ServiceAPIDescription data structure with:
- apiId
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}
- Response to Open Discover Request (no filter):
- 200 OK response.
- Response body must follow OpenDiscoveryResp data structure:
- Check if
discApiscontains the 2 previously published Service APIs.
- Check if
- Response to Open Discover Request (filtered by api-names=service_1):
- 200 OK response.
- Response body must follow OpenDiscoveryResp data structure:
- Check if
discApiscontains only the API published with api-name service_1.
- Check if
Test Case 5: Open Discover Published service APIs filtered by api-names with no match
Test ID: capif_api_open_discover_service-5
Description:
This test case will check that filtering by an api-name that does not match any published API returns 404 Not Found.
Pre-Conditions:
- At least 2 Service APIs are published.
Execution Steps:
- Register Provider at CCF, store certificates and Publish Service APIs service_1 and service_2 at CCF.
- Open Discover all Service APIs.
- Open Discover filtered by api-names NOT_VALID_NAME.
Information of Test:
- Perform Provider Registration
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_1
- Use APF Certificate
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_2
- Use APF Certificate
- Request Open Discover Published APIs:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis
- Use JWT Bearer Token
- Request Open Discover filtering by non-existent api-name:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis?api-names=NOT_VALID_NAME
- Use JWT Bearer Token
Expected Result:
- Response to each Publish request must accomplish:
- 201 Created
- Response Body must follow ServiceAPIDescription data structure with:
- apiId
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}
- Response to Open Discover Request (no filter):
- 200 OK response.
- Response body must follow OpenDiscoveryResp data structure:
- Check if
discApiscontains the 2 previously published Service APIs.
- Check if
- Response to Open Discover Request (filtered by api-names=NOT_VALID_NAME):
- 404 Not Found response.
- Error Response Body must accomplish with ProblemDetails data structure with:
- status 404
- title with message "Not Found"
- detail with message "No API Published accomplish filter conditions".
- cause with message "No API Published accomplish filter conditions".
Test Case 6: Open Discover Published service APIs not filtered
Test ID: capif_api_open_discover_service-6
Description:
This test case will check if an authenticated entity can open discover all published service APIs without applying any filter.
Pre-Conditions:
- 2 Service APIs are published.
Execution Steps:
- Register Provider at CCF, store certificates and Publish Service APIs service_1 and service_2 at CCF.
- Open Discover all Service APIs without filter.
Information of Test:
- Perform Provider Registration
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_1
- Use APF Certificate
- Publish Service API at CCF:
- Send POST to ccf_publish_url https://{CAPIF_HOSTNAME}/published-apis/v1/{apfId}/service-apis
- body service api description with apiName service_2
- Use APF Certificate
- Request Open Discover Published APIs not filtered:
- Send GET to https://{CAPIF_HOSTNAME}/open-api-disc/v1/service-apis
- Use JWT Bearer Token
Expected Result:
-
Response to each Publish request must accomplish:
- 201 Created
- Response Body must follow ServiceAPIDescription data structure with:
- apiId
- Response Header Location must be received with URI to new resource created, following this structure: {apiRoot}/published-apis/v1/{apfId}/service-apis/{serviceApiId}
-
Response to Open Discover Request:
- 200 OK response.
- Response body must follow OpenDiscoveryResp data structure:
- Check if
discApiscontains the 2 previously published Service APIs.
- Check if