Skip to content

Commit

Permalink
chore: add error scenario tests for bulk fspId
Browse files Browse the repository at this point in the history
  • Loading branch information
kleyow committed Jul 28, 2022
1 parent 5f01837 commit fb2fbc2
Showing 1 changed file with 384 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,384 @@
{
"name": "multi",
"test_cases": [
{
"id": 1,
"name": "negative scenario - invalid payee name in request",
"meta": {
"info": "negative scenario - invalid payee name"
},
"fileInfo": {
"path": "testing-toolkit-test-cases/collections/hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json"
},
"requests": [
{
"id": 3,
"meta": {
"info": "Send Bulk Prepare. Invalid payee participant should return error."
},
"description": "Send Prepare invalid payee name body only",
"apiVersion": {
"minorVersion": 1,
"majorVersion": 1,
"type": "fspiop",
"asynchronous": true
},
"operationPath": "/bulkTransfers",
"method": "post",
"url": "{$inputs.HOST_BULK_ADAPTER}",
"headers": {
"Accept": "{$inputs.acceptBulkTransfers}",
"Content-Type": "{$inputs.contentBulkTransfers}",
"Date": "{$function.generic.curDate}",
"FSPIOP-Source": "{$inputs.fromFspId}",
"FSPIOP-Destination": "{$inputs.toFspId}"
},
"body": {
"bulkTransferId": "{$function.generic.generateUUID}",
"bulkQuoteId": "{$function.generic.generateUUID}",
"payeeFsp": "DUMMY",
"payerFsp": "{$environment.fromFspId}",
"individualTransfers": [
{
"transferId": "{$function.generic.generateUUID}",
"transferAmount": {
"currency": "{$inputs.currency}",
"amount": "1"
},
"ilpPacket": "{$environment.validIlpPacket2}",
"condition": "{$environment.validCondition2}",
"extensionList": {
"extension": [
{
"key": "extKey1",
"value": "extValue1"
},
{
"key": "extKey2",
"value": "extValue2"
}
]
}
},
{
"transferId": "{$function.generic.generateUUID}",
"transferAmount": {
"currency": "GBP",
"amount": "2"
},
"ilpPacket": "{$environment.validIlpPacket2}",
"condition": "{$environment.validCondition2}"
}
],
"expiration": "{$environment.expirationDate}"
},
"tests": {
"assertions": [
{
"id": 1,
"description": "Status code is 202",
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 17,
"description": "payer callback - should be error 3100. request.body participant not found.",
"exec": [
"expect(callback.body.errorInformation.errorCode).to.equal('3100')",
"expect(callback.body.errorInformation.errorDescription).to.equal(`Generic validation error - Participant {$request.body.payeeFsp} not found`)"
]
}
]
},
"ignoreCallbacks": false,
"params": {
"name": "testingtoolkitdfsp"
},
"path": "/bulkTransfers",
"scriptingEngine": "javascript",
"scripts": {
"preRequest": {
"exec": [
"const delay = 1000 * 3600 * 24",
"const now = new Date()",
"const expirationDate = new Date(now.getTime() + delay).toISOString();",
"const completedTimestamp = now.toISOString();",
"",
"environment[\"bulkTransferId\"] = request.body.bulkTransferId",
"environment[\"bulkQuoteId\"] = request.body.bulkQuoteId",
"environment[\"transferId\"] = request.body.individualTransfers[0].transferId",
"environment[\"transferId2\"] = request.body.individualTransfers[1].transferId",
"environment[\"expirationDate\"] = expirationDate",
"environment[\"completedTimestamp\"] = completedTimestamp",
"",
"",
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')",
"}"
]
},
"postRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
" environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)",
"}"
]
}
}
},
{
"id": 7,
"description": "Send Prepare Invalid payee name header only",
"meta": {
"info": "Send Bulk Prepare. Invalid payee participant should return error."
},
"apiVersion": {
"minorVersion": 1,
"majorVersion": 1,
"type": "fspiop",
"asynchronous": true
},
"operationPath": "/bulkTransfers",
"method": "post",
"url": "{$inputs.HOST_BULK_ADAPTER}",
"headers": {
"Accept": "{$inputs.acceptBulkTransfers}",
"Content-Type": "{$inputs.contentBulkTransfers}",
"Date": "{$function.generic.curDate}",
"FSPIOP-Source": "{$inputs.fromFspId}",
"FSPIOP-Destination": "DUMMY"
},
"body": {
"bulkTransferId": "{$function.generic.generateUUID}",
"bulkQuoteId": "{$function.generic.generateUUID}",
"payeeFsp": "{$environment.toFspId}",
"payerFsp": "{$environment.fromFspId}",
"individualTransfers": [
{
"transferId": "{$function.generic.generateUUID}",
"transferAmount": {
"currency": "{$inputs.currency}",
"amount": "1"
},
"ilpPacket": "{$environment.validIlpPacket2}",
"condition": "{$environment.validCondition2}",
"extensionList": {
"extension": [
{
"key": "extKey1",
"value": "extValue1"
},
{
"key": "extKey2",
"value": "extValue2"
}
]
}
},
{
"transferId": "{$function.generic.generateUUID}",
"transferAmount": {
"currency": "GBP",
"amount": "2"
},
"ilpPacket": "{$environment.validIlpPacket2}",
"condition": "{$environment.validCondition2}"
}
],
"expiration": "{$environment.expirationDate}"
},
"tests": {
"assertions": [
{
"id": 1,
"description": "Status code is 202",
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 7,
"description": "payer callback - should be error 3100. request.headers['FSPIOP-Destination'] participant not found.",
"exec": [
"expect(callback.body.errorInformation.errorCode).to.equal('3100')",
"expect(callback.body.errorInformation.errorDescription).to.equal(`Generic validation error - Participant {$request.headers['FSPIOP-Destination']} not found`)"
]
}
]
},
"ignoreCallbacks": false,
"params": {
"name": "testingtoolkitdfsp",
"ID": ""
},
"path": "/bulkTransfers",
"scriptingEngine": "javascript",
"scripts": {
"preRequest": {
"exec": [
"const delay = 1000 * 3600 * 24",
"const now = new Date()",
"const expirationDate = new Date(now.getTime() + delay).toISOString();",
"const completedTimestamp = now.toISOString();",
"",
"environment[\"bulkTransferId\"] = request.body.bulkTransferId",
"environment[\"bulkQuoteId\"] = request.body.bulkQuoteId",
"environment[\"transferId\"] = request.body.individualTransfers[0].transferId",
"environment[\"transferId2\"] = request.body.individualTransfers[1].transferId",
"environment[\"expirationDate\"] = expirationDate",
"environment[\"completedTimestamp\"] = completedTimestamp",
"",
"",
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')",
"}"
]
},
"postRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
" environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)",
"}"
]
}
}
}
]
},
{
"id": 2,
"name": "negative scenario - invalid payer name in request",
"meta": {
"info": "negative scenario - invalid payer name"
},
"fileInfo": {
"path": "testing-toolkit-test-cases/collections/hub/other_tests/bulk_transfers/bulk-invalid-dfsp-name-header-and-body.json"
},
"requests": [
{
"id": 3,
"meta": {
"info": "Send Bulk Prepare. Mismatching payer in header and body should return error."
},
"description": "Send Prepare invalid payer name body only",
"apiVersion": {
"minorVersion": 1,
"majorVersion": 1,
"type": "fspiop",
"asynchronous": true
},
"operationPath": "/bulkTransfers",
"method": "post",
"url": "{$inputs.HOST_BULK_ADAPTER}",
"headers": {
"Accept": "{$inputs.acceptBulkTransfers}",
"Content-Type": "{$inputs.contentBulkTransfers}",
"Date": "{$function.generic.curDate}",
"FSPIOP-Source": "{$inputs.fromFspId}",
"FSPIOP-Destination": "{$inputs.toFspId}"
},
"body": {
"bulkTransferId": "{$function.generic.generateUUID}",
"bulkQuoteId": "{$function.generic.generateUUID}",
"payeeFsp": "{$inputs.toFspId}",
"payerFsp": "DUMMY",
"individualTransfers": [
{
"transferId": "{$function.generic.generateUUID}",
"transferAmount": {
"currency": "{$inputs.currency}",
"amount": "1"
},
"ilpPacket": "{$environment.validIlpPacket2}",
"condition": "{$environment.validCondition2}",
"extensionList": {
"extension": [
{
"key": "extKey1",
"value": "extValue1"
},
{
"key": "extKey2",
"value": "extValue2"
}
]
}
},
{
"transferId": "{$function.generic.generateUUID}",
"transferAmount": {
"currency": "GBP",
"amount": "2"
},
"ilpPacket": "{$environment.validIlpPacket2}",
"condition": "{$environment.validCondition2}"
}
],
"expiration": "{$environment.expirationDate}"
},
"tests": {
"assertions": [
{
"id": 1,
"description": "Status code is 202",
"exec": [
"expect(response.status).to.equal(202)"
]
},
{
"id": 7,
"description": "payee callback - should be error 3100. FSPIOP-Source header should match Payer.",
"exec": [
"expect(callback.body.errorInformation.errorCode).to.equal('3100')",
"expect(callback.body.errorInformation.errorDescription).to.equal(`Generic validation error - FSPIOP-Source header should match Payer`)"
]
}
]
},
"ignoreCallbacks": false,
"params": {
"name": "testingtoolkitdfsp"
},
"path": "/bulkTransfers",
"scriptingEngine": "javascript",
"scripts": {
"preRequest": {
"exec": [
"const delay = 1000 * 3600 * 24",
"const now = new Date()",
"const expirationDate = new Date(now.getTime() + delay).toISOString();",
"const completedTimestamp = now.toISOString();",
"",
"environment[\"bulkTransferId\"] = request.body.bulkTransferId",
"environment[\"bulkQuoteId\"] = request.body.bulkQuoteId",
"environment[\"transferId\"] = request.body.individualTransfers[0].transferId",
"environment[\"transferId2\"] = request.body.individualTransfers[1].transferId",
"environment[\"expirationDate\"] = expirationDate",
"environment[\"completedTimestamp\"] = completedTimestamp",
"",
"",
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/requests/{$request.body.bulkTransferId}', 'payeeRequest')",
" await websocket.connect(environment.PAYEEFSP_SDK_TESTAPI_WS_URL + '/callbacks/{$request.body.bulkTransferId}', 'payeeCallback')",
"}"
]
},
"postRequest": {
"exec": [
"if (environment.ENABLE_WS_ASSERTIONS===true) {",
" environment.bulkTransfersNegativeRequest = await websocket.getMessage('payeeRequest', environment.WS_ASSERTION_TIMEOUT)",
" environment.bulkTransfersNegativeCallback = await websocket.getMessage('payeeCallback', environment.WS_ASSERTION_TIMEOUT)",
"}"
]
}
}
}
]
}
]
}

0 comments on commit fb2fbc2

Please sign in to comment.