Skip to content

Commit

Permalink
fix: openapi tests for besu, htlc-eth-besu and htlc-eth-besu-erc20
Browse files Browse the repository at this point in the history
Changes endpoints getSingleStatus and getStatus in htlc-eth-besu
and htlc-eth-besu-erc20 which now are of type post and defines
for that new request schemas.

Includes tests for all endpoints in besu, htlc-eth-besu and
htlc-eth-besu-erc20, each of them with test cases:
  - Right request
  - Request including an invalid parameter
  - Request without a required parameter

Closes hyperledger-cacti#1291

Relationed with hyperledger-cacti#847

Signed-off-by: Elena Izaguirre <e.izaguirre.equiza@accenture.com>
  • Loading branch information
elenaizaguirre authored and RafaelAPB committed Nov 19, 2021
1 parent cfb7e17 commit 9ac0165
Show file tree
Hide file tree
Showing 25 changed files with 2,907 additions and 492 deletions.
142 changes: 68 additions & 74 deletions packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,57 @@
}
}
},
"GetStatusRequest": {
"description": "Defines the parameters for retrieving the status of the HTLC swap.",
"required": [
"ids",
"web3SigningCredential",
"connectorId",
"keychainId"
],
"additionalProperties": false,
"properties": {
"ids": {
"type": "array",
"items": {
"type": "string"
}
},
"web3SigningCredential": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
},
"connectorId": {
"type": "string"
},
"keychainId": {
"type": "string"
}
}
},
"GetSingleStatusRequest": {
"description": "Defines the parameters for retrieving the single status of the HTLC swap.",
"required": [
"id",
"web3SigningCredential",
"connectorId",
"keychainId"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"web3SigningCredential": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
},
"connectorId": {
"type": "string"
},
"keychainId": {
"type": "string"
}
}
},
"InitializeRequest": {
"type": "object",
"required": [
Expand Down Expand Up @@ -325,53 +376,23 @@
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status": {
"get": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "get",
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status"
}
},
"operationId": "getStatusV1",
"summary": "Get array of status of a hashtimelock contract, the status are ( 0 - Invalid, 1 - Active, 2 - Refunded, 3 - Withdrawn, 4 - Expired)",
"parameters": [
{
"name": "ids",
"in": "query",
"required": true,
"schema": {
"type": "array",
"items": {
"type": "string",
"format": "bytes32"
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetStatusRequest"
}
}
},
{
"name": "web3SigningCredential",
"in": "query",
"required": true,
"schema": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
}
},
{
"name": "connectorId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "keychainId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
}
],
},
"responses": {
"200": {
"description": "OK",
Expand All @@ -381,50 +402,23 @@
}
},
"/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status": {
"get": {
"post": {
"x-hyperledger-cactus": {
"http": {
"verbLowerCase": "get",
"verbLowerCase": "post",
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status"
}
},
"operationId": "getSingleStatusV1",
"summary": "Get a status of a hashtimelock contract, the status are ( 0 - Invalid, 1 - Active, 2 - Refunded, 3 - Withdrawn, 4 - Expired)",
"parameters": [
{
"name": "id",
"in": "query",
"required": true,
"schema": {
"type": "string",
"format": "bytes32"
}
},
{
"name": "web3SigningCredential",
"in": "query",
"required": true,
"schema": {
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
}
},
{
"name": "connectorId",
"in": "query",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "keychainId",
"in": "query",
"required": true,
"schema": {
"type": "string"
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSingleStatusRequest"
}
}
}
],
},
"responses": {
"200": {
"description": "OK",
Expand Down
Loading

0 comments on commit 9ac0165

Please sign in to comment.