From 9d44c12fac88601ae0693db5cbd6b4040b68283d Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Mon, 4 Nov 2024 12:17:41 +0300 Subject: [PATCH] Postman --- .../Spring Validation.postman_collection.json | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 postman/Spring Validation.postman_collection.json diff --git a/postman/Spring Validation.postman_collection.json b/postman/Spring Validation.postman_collection.json new file mode 100644 index 0000000..dc255f7 --- /dev/null +++ b/postman/Spring Validation.postman_collection.json @@ -0,0 +1,109 @@ +{ + "info": { + "_postman_id": "bb233500-0318-496e-9882-071ee5de34a0", + "name": "Spring Validation", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "16442716" + }, + "item": [ + { + "name": "Person", + "item": [ + { + "name": "Create Person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"violations is not null\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.violations).is.not.null;", + " pm.expect(jsonData.violations[0].fieldName).to.be.oneOf([\"numberBetweenOneAndTen\", \"ipAddress\", \"name\"])", + " pm.expect(jsonData.violations[1].fieldName).to.be.oneOf([\"numberBetweenOneAndTen\", \"ipAddress\", \"name\"])", + " pm.expect(jsonData.violations[2].fieldName).to.be.oneOf([\"numberBetweenOneAndTen\", \"ipAddress\", \"name\"])", + " pm.expect(jsonData.violations[0].message).to.be.oneOf([\"Не соответствует формату IP адреса\", \"должно быть не больше 10\", \"не должно быть пустым\"])", + " pm.expect(jsonData.violations[1].message).to.be.oneOf([\"Не соответствует формату IP адреса\", \"должно быть не больше 10\", \"не должно быть пустым\"])", + " pm.expect(jsonData.violations[2].message).to.be.oneOf([\"Не соответствует формату IP адреса\", \"должно быть не больше 10\", \"не должно быть пустым\"])", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"name\": null,\n \"numberBetweenOneAndTen\": 20,\n \"ipAddress\": \"15434.250.124.\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8080/api/person", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "api", + "person" + ] + } + }, + "response": [] + }, + { + "name": "Get Person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"violations is not null\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.violations).is.not.null;", + " pm.expect(jsonData.violations[0].fieldName).to.be.eq(\"getById.personId\")", + " pm.expect(jsonData.violations[0].message).to.be.eq(\"должно быть не меньше 0\")", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:8080/api/person/-1", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "api", + "person", + "-1" + ] + } + }, + "response": [] + } + ] + } + ] +} \ No newline at end of file