/
Maxvas123
/
TestRepository
Обзор
Документация
Войти
/
Maxvas123
/
TestRepository
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
postman/feature.json
655 строк
14 KB
Maxim Vasilyev
Step 3: add feature
21 сен 2023, 17:53
21 сен 2023, 17:53
71fd628
Код
Авторство
О чём код?
{ "info": { "_postman_id": "055e9452-dc6e-4802-817f-909d7a1ffc3a", "name": "FeatureSubscribe", "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json", "_exporter_id": "25274650" }, "item": [ { "name": "добавление подписки", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 201 и данные в формате json\", function() {\r", " pm.expect(pm.response.code).to.equal(201);\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "}); \r", "pm.test(\"Test user 'id' field\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.have.property('id');\r", " pm.expect(jsonData.id, '\"id\" must be 1').to.eql(1);\r", "});\r", "\r", "pm.test(\"Test user 'name' field\", function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.have.property('name');\r", "});\r", "\r", "pm.test('Test user followers field', function () {\r", " var jsonData = pm.response.json();\r", " pm.expect(jsonData).to.have.property('followers');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId" ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "добавление подписки тем же пользователем", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на ошибку добавления подписчика\", function() {\r", " pm.expect(pm.response.code).to.equal(409);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId" ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "1" } ] } }, "response": [] }, { "name": "добавление подписки на уже подписанного пользователя", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на ошибку добавления подписчика\", function() {\r", " pm.expect(pm.response.code).to.equal(409);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId" ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "получение новостной ленты со стандартными параметрами", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function() {\r", " pm.response.to.be.ok;\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "}); \r", "\r", "pm.test(\"Ответ должен быть списком событий\", function() {\r", " const body = pm.response.json();\r", " pm.expect(body).is.an('array');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId/events?from=1&size=10", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "1" }, { "key": "size", "value": "10" } ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "получение ошибки на негативных параметрах", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на валидацию параметров\", function() {\r", " pm.expect(pm.response.code).to.equal(400);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId/events?from=-1&size=10", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "-1" }, { "key": "size", "value": "10" } ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "получение ошибки с нулевыми параметрами", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на валидацию параметров\", function() {\r", " pm.expect(pm.response.code).to.equal(400);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId/events?from=0&size=0", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "0" }, { "key": "size", "value": "0" } ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "получение ошибки на нподписанного пользователя", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на ошибку получения событий без подписки\", function() {\r", " pm.expect(pm.response.code).to.equal(409);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId/events?from=0&size=10", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "0" }, { "key": "size", "value": "10" } ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "3" } ] } }, "response": [] }, { "name": "получение всеё новостной ленты", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Ответ должен содержать код статуса 200 и данные в формате json\", function() {\r", " pm.response.to.be.ok;\r", " pm.response.to.be.withBody;\r", " pm.response.to.be.json;\r", "}); \r", "\r", "pm.test(\"Ответ должен быть списком событий\", function() {\r", " const body = pm.response.json();\r", " pm.expect(body).is.an('array');\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/followers/:followerId/events?from=0&size=10&sort=NEW", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "0" }, { "key": "size", "value": "10" }, { "key": "sort", "value": "NEW" } ], "variable": [ { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "получение ошибки всеё новостной ленты на негативных параметрах", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на валидацию параметров\", function() {\r", " pm.expect(pm.response.code).to.equal(400);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/followers/:followerId/events?from=-1&size=10&sort=NEW", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "-1" }, { "key": "size", "value": "10" }, { "key": "sort", "value": "NEW" } ], "variable": [ { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "получение ошибки всей ленты с нулевым параметром", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на валидацию параметров\", function() {\r", " pm.expect(pm.response.code).to.equal(400);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8080/users/followers/:followerId/events?from=0&size=0&sort=NEW", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", "followers", ":followerId", "events" ], "query": [ { "key": "from", "value": "0" }, { "key": "size", "value": "0" }, { "key": "sort", "value": "NEW" } ], "variable": [ { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "удаление подписки", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на удаление подписчика\", function() {\r", " pm.expect(pm.response.code).to.equal(204);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId" ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "2" } ] } }, "response": [] }, { "name": "ошибка удалении на неподписанного пользователя", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Тест на удаление подписчика\", function() {\r", " pm.expect(pm.response.code).to.equal(409);\r", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "http://localhost:8080/users/:userId/followers/:followerId", "protocol": "http", "host": [ "localhost" ], "port": "8080", "path": [ "users", ":userId", "followers", ":followerId" ], "variable": [ { "key": "userId", "value": "1" }, { "key": "followerId", "value": "3" } ] } }, "response": [] } ] }