/
eb
/
java-explore-with-me
Обзор
Документация
Войти
/
eb
/
java-explore-with-me
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
postman/feature.json
1 612 строк
42 KB
Evgeniy Budaev
Этап 3. Дополнительная функциональность
25 мар 2023, 11:13
25 мар 2023, 11:13
b496e60
Код
Авторство
О чём код?
{ "info": { "_postman_id": "fe66f6cb-771c-45bd-a31c-8fb7fbe59807", "name": "Test feature_comments", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "18364591" }, "item": [ { "name": "comments POST", "item": [ { "name": "Добавление нового комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 201 и данные в формате json\", function () {\r", " pm.response.to.have.status(201);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const source = JSON.parse(pm.request.body.raw);\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});\r", "\r", "pm.test(\"Данные в ответе должны соответствовать данным в запросе\", function () {\r", " pm.expect(target.id).to.not.be.null;\r", " pm.expect(target.created).to.not.be.null;\r", " pm.expect(target.authorName).to.not.be.null;\r", " pm.expect(target.eventId).to.not.be.null;\r", " pm.expect(source.text).equal(target.text, 'Текст комментария должен соответствовать отправленному в запросе');\r", "});\r", "\r", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Событие класс! Мне все понравилось\"\r\n}" }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:eventId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":eventId" ], "variable": [ { "key": "userId", "value": "25" }, { "key": "eventId", "value": "15" } ] } }, "response": [] }, { "name": "Добавление нового комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 201 и данные в формате json\", function () {\r", " pm.response.to.have.status(201);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const source = JSON.parse(pm.request.body.raw);\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});\r", "\r", "pm.test(\"Данные в ответе должны соответствовать данным в запросе\", function () {\r", " pm.expect(target.id).to.not.be.null;\r", " pm.expect(target.created).to.not.be.null;\r", " pm.expect(target.authorName).to.not.be.null;\r", " pm.expect(target.eventId).to.not.be.null;\r", " pm.expect(source.text).equal(target.text, 'Текст комментария должен соответствовать отправленному в запросе');\r", "});\r", "\r", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Событие класс! Мне все понравилось\"\r\n}" }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:eventId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":eventId" ], "variable": [ { "key": "userId", "value": "34" }, { "key": "eventId", "value": "19" } ] } }, "response": [] }, { "name": "Добавление нового комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 201 и данные в формате json\", function () {\r", " pm.response.to.have.status(201);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const source = JSON.parse(pm.request.body.raw);\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});\r", "\r", "pm.test(\"Данные в ответе должны соответствовать данным в запросе\", function () {\r", " pm.expect(target.id).to.not.be.null;\r", " pm.expect(target.created).to.not.be.null;\r", " pm.expect(target.authorName).to.not.be.null;\r", " pm.expect(target.eventId).to.not.be.null;\r", " pm.expect(source.text).equal(target.text, 'Текст комментария должен соответствовать отправленному в запросе');\r", "});\r", "\r", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Событие класс! Мне все понравилось\"\r\n}" }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:eventId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":eventId" ], "variable": [ { "key": "userId", "value": "31" }, { "key": "eventId", "value": "18" } ] } }, "response": [] }, { "name": "Добавление нового комментария без тела запроса", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 400\", function () {\r", " pm.response.to.have.status(400);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:eventId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":eventId" ], "variable": [ { "key": "userId", "value": "25" }, { "key": "eventId", "value": "15" } ] } }, "response": [] }, { "name": "Добавление нового комментария c коротким текстом", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 400\", function () {\r", " pm.response.to.have.status(400);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Событие класс!\"\r\n}" }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:eventId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":eventId" ], "variable": [ { "key": "userId", "value": "25" }, { "key": "eventId", "value": "15" } ] } }, "response": [] }, { "name": "Добавление нового комментария c тестом из пробелов", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 400\", function () {\r", " pm.response.to.have.status(400);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\r\n \"text\": \" \"\r\n}" }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:eventId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":eventId" ], "variable": [ { "key": "userId", "value": "25" }, { "key": "eventId", "value": "15" } ] } }, "response": [] } ] }, { "name": "comments DELETE", "item": [ { "name": "Удаление пользователем своего комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 204\", function () {\r", " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "31" }, { "key": "commentId", "value": "3" } ] } }, "response": [] }, { "name": "Удаление пользователем чужого комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 409 и данные в формате json\", function () {\r", " pm.response.to.have.status(409);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "20" }, { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Удаление пользователем несуществующего комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "20" }, { "key": "commentId", "value": "33" } ] } }, "response": [] }, { "name": "Удаление несуществующим пользователем комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "202" }, { "key": "commentId", "value": "3" } ] } }, "response": [] }, { "name": "Удаление администратором комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 204\", function () {\r", " pm.response.to.have.status(204);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/admin/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments", ":commentId" ], "variable": [ { "key": "commentId", "value": "2" } ] } }, "response": [] }, { "name": "Удаление администратором несуществующего комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404\", function () {\r", " pm.response.to.have.status(404);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/admin/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments", ":commentId" ], "variable": [ { "key": "commentId", "value": "33" } ] } }, "response": [] } ] }, { "name": "comments PATCH", "item": [ { "name": "Обновление комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const source = JSON.parse(pm.request.body.raw);\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});\r", "\r", "pm.test(\"Данные в ответе должны соответствовать данным в запросе\", function () {\r", " pm.expect(target.id).to.not.be.null;\r", " pm.expect(target.created).to.not.be.null;\r", " pm.expect(target.authorName).to.not.be.null;\r", " pm.expect(target.eventId).to.not.be.null;\r", " pm.expect(source.text).equal(target.text, 'Текст комментария должен соответствовать отправленному в запросе');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Я передумал, событие не понравилось\"\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "25" }, { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Обновление пользователем чужого комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 409 и данные в формате json\", function () {\r", " pm.response.to.have.status(409);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Я передумал, событие не понравилось\"\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "34" }, { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Обновление пользователем несуществующего комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Я передумал, событие не понравилось\"\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "34" }, { "key": "commentId", "value": "111" } ] } }, "response": [] }, { "name": "Обновление несуществующим пользователем комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Я передумал, событие не понравилось\"\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "343" }, { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Обновление комментария администратором", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const source = JSON.parse(pm.request.body.raw);\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});\r", "\r", "pm.test(\"Данные в ответе должны соответствовать данным в запросе\", function () {\r", " pm.expect(target.id).to.not.be.null;\r", " pm.expect(target.created).to.not.be.null;\r", " pm.expect(target.authorName).to.not.be.null;\r", " pm.expect(target.eventId).to.not.be.null;\r", " pm.expect(source.text).equal(target.text, 'Текст комментария должен соответствовать отправленному в запросе');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "PATCH", "header": [], "body": { "mode": "raw", "raw": "{\r\n \"text\": \"Обновляю формулировку комментария\"\r\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/admin/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments", ":commentId" ], "variable": [ { "key": "commentId", "value": "1" } ] } }, "response": [] } ] }, { "name": "comments GET by User", "item": [ { "name": "Получение комментария автором", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "25" }, { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Получение комментария не его автором", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 409 и данные в формате json\", function () {\r", " pm.response.to.have.status(409); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "33" }, { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Получение комментария несуществующим пользователем", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "333" }, { "key": "commentId", "value": "2" } ] } }, "response": [] }, { "name": "Получение несуществующего комментария", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments", ":commentId" ], "variable": [ { "key": "userId", "value": "34" }, { "key": "commentId", "value": "222" } ] } }, "response": [] }, { "name": "Получение автором своих комментариев", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target.length).eql(1);\r", "pm.expect(target[0]).to.have.property('id');\r", "pm.expect(target[0]).to.have.property('text');\r", "pm.expect(target[0]).to.have.property('created');\r", "pm.expect(target[0]).to.have.property('authorName');\r", "pm.expect(target[0]).to.have.property('eventId');\r", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments?from=0&size=1&createStart=2022-03-06%2013%3A30%3A38&createEnd=2025-03-06%2013%3A30%3A38", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments" ], "query": [ { "key": "from", "value": "0" }, { "key": "size", "value": "1" }, { "key": "createStart", "value": "2022-03-06%2013%3A30%3A38" }, { "key": "createEnd", "value": "2025-03-06%2013%3A30%3A38" } ], "variable": [ { "key": "userId", "value": "25" } ] } }, "response": [] }, { "name": "Получение автором своих комментариев без указания параметров", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target.length).eql(1);\r", "pm.expect(target[0]).to.have.property('id');\r", "pm.expect(target[0]).to.have.property('text');\r", "pm.expect(target[0]).to.have.property('created');\r", "pm.expect(target[0]).to.have.property('authorName');\r", "pm.expect(target[0]).to.have.property('eventId');\r", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/users/:userId/comments?from=&size=&createStart=&createEnd=", "host": [ "{{baseUrl}}" ], "path": [ "users", ":userId", "comments" ], "query": [ { "key": "from", "value": "" }, { "key": "size", "value": "" }, { "key": "createStart", "value": "" }, { "key": "createEnd", "value": "" } ], "variable": [ { "key": "userId", "value": "25" } ] } }, "response": [] } ] }, { "name": "comments GET by Admin", "item": [ { "name": "Получение комментария админом", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target).to.have.property('id');\r", "pm.expect(target.id).eql(1);\r", "pm.expect(target).to.have.property('text');\r", "pm.expect(target).to.have.property('created');\r", "pm.expect(target).to.have.property('authorName');\r", "pm.expect(target).to.have.property('eventId');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/admin/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments", ":commentId" ], "variable": [ { "key": "commentId", "value": "1" } ] } }, "response": [] }, { "name": "Получение несуществующего комментария админом", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/admin/comments/:commentId", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments", ":commentId" ], "variable": [ { "key": "commentId", "value": "111" } ] } }, "response": [] }, { "name": "Получение комментариев события админом", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function () {\r", " pm.response.to.have.status(200); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});\r", "\r", "const target = pm.response.json();\r", "\r", "pm.test(\"Комментарий должен содержать поля: id, text, created, authorName, eventId\", function () {\r", "pm.expect(target.length).eql(1);\r", "pm.expect(target[0]).to.have.property('id');\r", "pm.expect(target[0]).to.have.property('text');\r", "pm.expect(target[0]).to.have.property('created');\r", "pm.expect(target[0]).to.have.property('authorName');\r", "pm.expect(target[0]).to.have.property('eventId');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/admin/comments?eventId=15&from=0&size=2", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments" ], "query": [ { "key": "eventId", "value": "15" }, { "key": "from", "value": "0" }, { "key": "size", "value": "2" } ] } }, "response": [] }, { "name": "Получение комментариев несуществующего события админом", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 404 и данные в формате json\", function () {\r", " pm.response.to.have.status(404); \r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [ { "key": "Accept", "value": "application/json", "type": "text" } ], "url": { "raw": "{{baseUrl}}/admin/comments?eventId=199&from=0&size=2", "host": [ "{{baseUrl}}" ], "path": [ "admin", "comments" ], "query": [ { "key": "eventId", "value": "199" }, { "key": "from", "value": "0" }, { "key": "size", "value": "2" } ] } }, "response": [] } ] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ], "variable": [ { "key": "baseUrl", "value": "http://localhost:8080" } ] }