generated from pagopa/template-java-spring-microservice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from pagopa/PPANTT-197-e-bollo-2-0-integration-…
…test-mdb-gps [PPANTT-197] feat: Add integration test
- Loading branch information
Showing
29 changed files
with
280 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ hs_err_pid* | |
# Helm | ||
/helm/charts/* | ||
**/.terraform/ | ||
|
||
# Integration tests | ||
*.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.3.6 | ||
1.8.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
APP_HOST=https://host | ||
GPS_MBD_HOST=https://api.dev.platform.pagopa.it/pagopa-gps-mbd-service/v1 | ||
MBD_PO_DESCRIPTION="Pagamento marca da bollo digitale" | ||
MBD_TRANSFER_REMITTANCE_INFORMATION="Pagamento marca da bollo digitale" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
APP_HOST=http://localhost:8080 | ||
GPS_MBD_HOST=http://localhost:8080 | ||
MBD_PO_DESCRIPTION="Pagamento marca da bollo digitale" | ||
MBD_TRANSFER_REMITTANCE_INFORMATION="Pagamento marca da bollo digitale" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
APP_HOST=https://host | ||
GPS_MBD_HOST=https://api.uat.platform.pagopa.it/pagopa-gps-mbd-service/v1 | ||
MBD_PO_DESCRIPTION="Pagamento marca da bollo digitale" | ||
MBD_TRANSFER_REMITTANCE_INFORMATION="Pagamento marca da bollo digitale" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Feature: All about MBD payment option build request handled by pagopa-gps-mbd-service | ||
|
||
Scenario: successful build payment option request | ||
When an http POST request is sent to gps-mbd-service with valid request body | ||
Then the statusCode is 200 | ||
And the response body has the expected values | ||
|
||
Scenario: fail build payment option request for null amount | ||
When an http POST request is sent to gps-mbd-service with invalid 'amount' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for null debtor name | ||
When an http POST request is sent to gps-mbd-service with invalid 'debtorName' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for null debtor surname | ||
When an http POST request is sent to gps-mbd-service with invalid 'debtorSurname' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for null debtor fiscal code | ||
When an http POST request is sent to gps-mbd-service with invalid 'debtorFiscalCode' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for null debtor email | ||
When an http POST request is sent to gps-mbd-service with invalid 'debtorEmail' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for empty CI fiscal code | ||
When an http POST request is sent to gps-mbd-service with invalid 'ciFiscalCode' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for empty debtor residence province | ||
When an http POST request is sent to gps-mbd-service with invalid 'debtorProvince' request body | ||
Then the statusCode is 400 | ||
|
||
Scenario: fail build payment option request for document hash too short | ||
When an http POST request is sent to gps-mbd-service with invalid 'documentHash' request body | ||
Then the statusCode is 400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
integration-test/src/step_definitions/gps-mbs-service_steps.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
const { After, When, Then } = require('@cucumber/cucumber') | ||
const assert = require("assert"); | ||
const { post } = require("./support/common"); | ||
const { buildRequestBody } = require("./support/util"); | ||
|
||
const gpsMbdServiceHost = process.env.GPS_MBD_HOST; | ||
const poDescription = process.env.MBD_PO_DESCRIPTION; | ||
const transferRemittanceInformation = process.env.MBD_TRANSFER_REMITTANCE_INFORMATION; | ||
|
||
let body = null; | ||
let responseToCheck = null; | ||
|
||
After(async function () { | ||
body = null; | ||
responseToCheck = null; | ||
}); | ||
|
||
When('an http POST request is sent to gps-mbd-service with valid request body', async () => { | ||
body = buildRequestBody(16, "00000000000", "PR", "1trA5qyjSZNwiwtGG46dyjRpL16TFgGCFvnfFzQrFHbB"); | ||
responseToCheck = await post(gpsMbdServiceHost + "/mbd/paymentOption", body); | ||
}); | ||
|
||
Then('the statusCode is {int}', function (statusCode) { | ||
assert.strictEqual(responseToCheck.status, statusCode); | ||
}); | ||
|
||
Then('the response body has the expected values', function () { | ||
assert.strictEqual(responseToCheck.data.paymentOption.length, 1); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].amount, body.properties.amount); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].description, poDescription); | ||
assert.notStrictEqual(responseToCheck.data.paymentOption[0].dueDate, undefined); | ||
assert.notStrictEqual(responseToCheck.data.paymentOption[0].retentionDate, undefined); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].isPartialPayment, false); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer.length, 1); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].organizationFiscalCode, body.properties.ciFiscalCode); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].idTransfer, "1"); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].amount, body.properties.amount); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].remittanceInformation, transferRemittanceInformation); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].stamp.hashDocument, body.properties.documentHash); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].stamp.stampType, "st"); | ||
assert.strictEqual(responseToCheck.data.paymentOption[0].transfer[0].stamp.provincialResidence, body.properties.debtorProvince); | ||
}); | ||
|
||
When('an http POST request is sent to gps-mbd-service with invalid {string} request body', async (invalidParam) => { | ||
body = buildRequestBody(16, "00000000000", "PR", "1trA5qyjSZNwiwtGG46dyjRpL16TFgGCFvnfFzQrFHbB"); | ||
|
||
switch (invalidParam) { | ||
case "amount": body.properties.amount = null; break; | ||
case "debtorName": body.properties.debtorName = ""; break; | ||
case "debtorSurname": body.properties.debtorSurname = ""; break; | ||
case "debtorEmail": body.properties.debtorEmail = ""; break; | ||
case "debtorFiscalCode": body.properties.debtorFiscalCode = ""; break; | ||
case "ciFiscalCode": body.properties.ciFiscalCode = ""; break; | ||
case "debtorProvince": body.properties.debtorProvince = ""; break; | ||
case "documentHash": body.properties.documentHash = "tooShortHash"; break; | ||
} | ||
|
||
responseToCheck = await post(gpsMbdServiceHost + "/mbd/paymentOption", body); | ||
}) |
Oops, something went wrong.