-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve validation and reject inconsistent order lines
- Loading branch information
Showing
10 changed files
with
507 additions
and
35 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"host" : "localhost", | ||
"port" : 5432, | ||
"database" : "okapi_modules", | ||
"username" : "folio_admin", | ||
"password" : "folio_admin" | ||
} |
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
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 |
---|---|---|
|
@@ -55,6 +55,9 @@ | |
import static org.folio.rest.core.exceptions.ErrorCodes.INACTIVE_EXPENSE_CLASS; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.INCORRECT_FUND_DISTRIBUTION_TOTAL; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.INSTANCE_ID_NOT_ALLOWED_FOR_PACKAGE_POLINE; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_OTHER_POL; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_PEMIX_POL; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.INVALID_PHYSICAL_POL; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.ISBN_NOT_VALID; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.MISMATCH_BETWEEN_ID_IN_PATH_AND_BODY; | ||
import static org.folio.rest.core.exceptions.ErrorCodes.MISSING_MATERIAL_TYPE; | ||
|
@@ -603,7 +606,7 @@ void testPostOrderWithIncorrectCost() throws Exception { | |
|
||
final Errors response = verifyPostResponse(COMPOSITE_ORDERS_PATH, JsonObject.mapFrom(reqData).encode(), | ||
prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10), APPLICATION_JSON, 422).as(Errors.class); | ||
assertThat(response.getErrors(), hasSize(10)); | ||
assertThat(response.getErrors(), hasSize(12)); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
Set<String> errorCodes = response.getErrors() | ||
.stream() | ||
.map(Error::getCode) | ||
|
@@ -615,7 +618,9 @@ void testPostOrderWithIncorrectCost() throws Exception { | |
PHYSICAL_COST_LOC_QTY_MISMATCH.getCode(), | ||
ELECTRONIC_COST_LOC_QTY_MISMATCH.getCode(), | ||
COST_UNIT_PRICE_ELECTRONIC_INVALID.getCode(), | ||
COST_UNIT_PRICE_INVALID.getCode())); | ||
COST_UNIT_PRICE_INVALID.getCode(), | ||
INVALID_OTHER_POL.getCode(), | ||
INVALID_PEMIX_POL.getCode())); | ||
} | ||
|
||
@Test | ||
|
@@ -729,7 +734,7 @@ void testPutOrderWithIncorrectQuantities() throws Exception { | |
|
||
APPLICATION_JSON, 422).as(Errors.class); | ||
|
||
assertThat(response.getErrors(), hasSize(5)); | ||
assertThat(response.getErrors(), hasSize(6)); | ||
Set<String> errorCodes = response.getErrors() | ||
.stream() | ||
.map(Error::getCode) | ||
|
@@ -739,7 +744,8 @@ void testPutOrderWithIncorrectQuantities() throws Exception { | |
ZERO_COST_PHYSICAL_QTY.getCode(), | ||
ELECTRONIC_COST_LOC_QTY_MISMATCH.getCode(), | ||
PHYSICAL_COST_LOC_QTY_MISMATCH.getCode(), | ||
ZERO_LOCATION_QTY.getCode())); | ||
ZERO_LOCATION_QTY.getCode(), | ||
INVALID_PEMIX_POL.getCode())); | ||
This comment has been minimized.
Sorry, something went wrong.
yuntianhu
Author
Contributor
|
||
} | ||
|
||
@Test | ||
|
@@ -2344,6 +2350,7 @@ void testPostOrdersCreateInventoryPhysicalNone() throws Exception { | |
reqData.getCompositePoLines().get(0).getCost().setListUnitPriceElectronic(0d); | ||
reqData.getCompositePoLines().get(0).getLocations().get(0).setQuantityElectronic(0); | ||
|
||
|
||
verifyPostResponse(COMPOSITE_ORDERS_PATH, JsonObject.mapFrom(reqData).toString(), | ||
prepareHeaders(EXIST_CONFIG_X_OKAPI_TENANT_LIMIT_10, X_OKAPI_USER_ID), APPLICATION_JSON, 201).as(CompositePurchaseOrder.class); | ||
|
||
|
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
Oops, something went wrong.
increase hasSize to 12 due more errors produced by new validators