Created
January 13, 2015 22:02
-
-
Save danfunk/dec358d78873bc4f5eb4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| } ~ | |
| path("products" / "bulk") { | |
| logger.debug("Products Bulk endpoint called.") | |
| put { | |
| logger.debug(" ..... and it got this far with a put." ) | |
| entity(as[BulkUpdateCommand]) { bulkUpdateCommand => | |
| logger.debug(" ..... and it got this far with " + bulkUpdateCommand) | |
| respondWithStatus(NoContent) { | |
| complete { | |
| productService.bulkAction(bulkUpdateCommand) | |
| } | |
| } | |
| } | |
| } | |
| } ~ | |
| path("products" / Segment) { styleId => | |
| get { | |
| .... | |
| "Direct /products/bulk PUT" should { | |
| "modify the activation status on a group of products at once" in { | |
| val bulkUpdate = BulkUpdateCommand("isActive", false, List("1", "2")) | |
| Put("/products/bulk", bulkUpdate) ~> | |
| dbTools.tokenHeader ~> | |
| sealRoute(productRoute) ~> | |
| check { | |
| status === NoContent | |
| dbTools.getProduct("1").isActive === false | |
| dbTools.getProduct("2").isActive === false | |
| } | |
| val bulkUpdate2 = BulkUpdateCommand("isActive", true, List("1", "2")) | |
| Put("/products/bulk", bulkUpdate2) ~> | |
| dbTools.tokenHeader ~> | |
| sealRoute(productRoute) ~> | |
| check { | |
| status === NoContent | |
| dbTools.getProduct("1").isActive === true | |
| dbTools.getProduct("2").isActive === true | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment